Skip to content

Test coverage improvements - Core#3503

Merged
zinduolis merged 31 commits intobeefproject:masterfrom
jake-the-dev:coverage-improvements
Feb 5, 2026
Merged

Test coverage improvements - Core#3503
zinduolis merged 31 commits intobeefproject:masterfrom
jake-the-dev:coverage-improvements

Conversation

@jake-the-dev
Copy link
Contributor

@jake-the-dev jake-the-dev commented Jan 22, 2026

Pull Request

Thanks for submitting a PR! Please fill in this template where appropriate:

Category

Tests

Feature/Issue Description

Q: Please give a brief summary of your feature/fix
A: Improving test coverage utilising SimpleCov for tracking. I understand this PR is massive, but I don't think there's a quick way of introducing a large amount of coverage. This may be the least painful way.

Current coverage overview:
image

Current result from tests:
(note, pending tests already existed)
image

NOTE: the creation of tests has been AI assisted but also painstakingly reviewed and adjusted for each and every file.

Q: Give a technical rundown of what you have changed (if applicable)
A: I'm going through the beef/core files and creating tests for them ensure the core functionality is tested and trusted.
Trying not to change any business logic - only some lint issues as I come across them due to updates in Ruby over time.

Test Cases

Q: Describe your test cases, what you have covered and if there are any use cases that still need addressing.
A: Anything and everything in beef/core. Not touching beef/extensions or been/modules in this PR as it's already large enough.

Wiki Page

If you are adding a new feature that is not easily understood without context, please draft a section to be added to the Wiki below.
N/A

@jake-the-dev jake-the-dev temporarily deployed to Integrate Pull Request January 22, 2026 07:55 — with GitHub Actions Inactive
@jake-the-dev jake-the-dev marked this pull request as draft January 22, 2026 07:57
@jake-the-dev jake-the-dev changed the title Test coverage improvements WIP | Test coverage improvements Jan 22, 2026
Comment on lines +9 to +23
if IO.popen(%w[which espeak], 'r').read.to_s.eql?('')
print_error('[Text to Voice] eSpeak is not in $PATH (brew install espeak on macOS, apt-get install espeak on Linux)')
return
end
if IO.popen(%w[which lame], 'r').read.to_s.eql?('')
print_error('[Text to Voice] Lame is not in $PATH (apt-get install lame)')
print_error('[Text to Voice] Lame is not in $PATH (brew install lame on macOS, apt-get install lame on Linux)')
return
end
if IO.popen(%w[which espeak], 'r').read.to_s.eql?('')
print_error('[Text to Voice] eSpeak is not in $PATH (apt-get install espeak)')

# Load espeak gem (only if binaries are available)
begin
require 'espeak'
include ESpeak
rescue LoadError, StandardError => e
print_error("[Text to Voice] Failed to load espeak gem: #{e.message}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional logging to help with new installs. This caught me out.

Comment on lines +1 to +5
RSpec.describe BeEF::Filters do
describe '.is_non_empty_string?' do
it 'nil' do
expect(BeEF::Filters.is_non_empty_string?(nil)).to be(false)
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaces the old filters_spec.rb that was missing methods and combined different files. This is more specific

@jake-the-dev jake-the-dev temporarily deployed to Integrate Pull Request January 23, 2026 01:32 — with GitHub Actions Inactive
@jake-the-dev jake-the-dev temporarily deployed to Integrate Pull Request January 23, 2026 04:38 — with GitHub Actions Inactive
@jake-the-dev jake-the-dev temporarily deployed to Integrate Pull Request January 23, 2026 05:27 — with GitHub Actions Inactive
@zinduolis
Copy link
Contributor

Hey @jake-the-dev ,

Are you still working on this PR or it's ready for review? I can see its status is Draft.

Thanks

@jake-the-dev
Copy link
Contributor Author

Hey @jake-the-dev ,

Are you still working on this PR or it's ready for review? I can see its status is Draft.

Thanks

Hi @zinduolis , I initially intended to continue this until core was sufficiently covered. However on Friday Wade had asked for this to be merged.

I don't have the permissions so i assumed he was going to merge - or maybe thats something he left with you?

To clarify - I will remove draft and any further iterations to core tests will be in another pr.

Feel free to review if you wish, no functional code should be changed so it should all just be assertions on existing logic.

@zinduolis
Copy link
Contributor

zinduolis commented Jan 26, 2026

Thanks, @jake-the-dev , just click Ready for review and I will review it and will let you know when you're good to merge (Wade asked me to review it). If you don't have permissions to merge, i'll happy to do that on your behalf once successful review.

@jake-the-dev jake-the-dev marked this pull request as ready for review January 26, 2026 23:54
@zinduolis
Copy link
Contributor

Hi @jake-the-dev ,

I've noticed a lot of spec files are missing the Copyright statement at the top. Could you please add it? Thanks

@jake-the-dev jake-the-dev temporarily deployed to Integrate Pull Request January 30, 2026 04:48 — with GitHub Actions Inactive
@jake-the-dev jake-the-dev temporarily deployed to Integrate Pull Request January 30, 2026 05:38 — with GitHub Actions Inactive
@jake-the-dev
Copy link
Contributor Author

jake-the-dev commented Jan 30, 2026

I've noticed a lot of spec files are missing the Copyright statement at the top. Could you please add it? Thanks

@zinduolis Good catch. I've added those - plus added it for some other specs that were missing it 👍

Have removed the API related specs given the future deprecation and actioned your other comments too. All yours again.
I'm working on another branch to continue the remaining core tests.

@jake-the-dev jake-the-dev temporarily deployed to Integrate Pull Request February 2, 2026 01:07 — with GitHub Actions Inactive
@zinduolis zinduolis temporarily deployed to Integrate Pull Request February 3, 2026 22:43 — with GitHub Actions Inactive
Copy link
Contributor

@zinduolis zinduolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR significantly improves test coverage for the BeEF core using SimpleCov. It focuses strictly on beef/core and avoids changing business logic, limiting modifications to minor linting fixes.

Scope of Changes

Comprehensive test coverage for:

  • Core Models & Handlers: Hooked browsers, browser details, commands, and results.
  • Network Stack: Asset handling, dynamic reconstruction, and redirection.
  • Filters & Utilities: Data validation filters, router logic, and Ruby core extensions.
  • System Checks: Filesystem and security check verifications.

Key Discussion Points & Status

  • Resolved: Added missing copyright headers to all new spec files.
  • Resolved: Removed API-related tests due to future deprecation plans.
  • ARE Conflict: Handled separately (acknowledging the overlap with PR #3482 removal). This PR does not touch Autorun Engine code anymore.

@jake-the-dev
Copy link
Contributor Author

@zinduolis Looks like I don't have permissions to merge - I'll leave this with you if you'd be so kind. 🚀

@zinduolis zinduolis merged commit fa87807 into beefproject:master Feb 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants