Skip to content

Add unit tests for execution package to achieve 100% coverage #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

ic0ns
Copy link
Contributor

@ic0ns ic0ns commented Jun 18, 2025

Summary

  • Added comprehensive unit tests for all classes in de.rub.nds.scanner.core.execution package
  • Created test implementations for abstract classes and interfaces to enable testing
  • Achieved coverage of all methods and edge cases

Changes

  • NamedThreadFactoryTest: Tests thread naming, incrementing numbers, and thread properties
  • ScanJobTest: Tests construction, list copying, and immutability
  • ScanJobExecutorTest: Tests abstract class implementation and method signatures
  • ScannerTest: Tests scan flow, prerequisites, probe registration, file output, and lifecycle
  • ScannerThreadPoolExecutorTest: Tests thread pool behavior, timeouts, and semaphore handling
  • ThreadedScanJobExecutorTest: Tests concurrent execution, property changes, and statistics collection

ic0ns added 11 commits June 18, 2025 21:04
- Test thread naming with prefix and incrementing numbers
- Test multiple threads creation
- Test thread properties (non-daemon)
- Test different prefixes and special characters
- Test thread execution of runnables
- Test construction with empty and non-empty lists
- Test that getter methods return copies (defensive copying)
- Test immutability of internal lists
- Test preservation of list order
- Test abstract methods implementation
- Test execute method behavior
- Test shutdown method behavior
- Test InterruptedException handling
- Verify abstract class and method signatures
- Test both constructors (with and without probe lists)
- Test scan flow with prerequisites check
- Test probe registration methods
- Test lifecycle methods (onScanStart, onScanEnd)
- Test integration with SiteReportRater and Guidelines
- Test file output functionality
- Test timing measurements
- Test AutoCloseable implementation
- Test basic construction and configuration
- Test all submit methods (Runnable, Runnable with result, Callable)
- Test semaphore release behavior on success and failure
- Test task timeout functionality
- Test multiple concurrent tasks
- Test shutdown behavior and policies
- Test edge cases like tasks completing before timeout
- Test basic execution flow with probes and after probes
- Test handling of probes that cannot be executed
- Test exception handling during probe execution
- Test property change listener functionality
- Test statistics collection and merging
- Test shutdown and AutoCloseable interface
- Test custom executor constructor
- Test edge cases (empty probe list, invalid property changes)
- Test merging of extracted value containers
- Update test probe implementations to match ScannerProbe API
- Add required method implementations (mergeData, getRequirements)
- Fix constructor calls to use ProbeType parameter
- Add missing imports and methods in TestReport
- Add serializeToJson implementation to all TestReport classes
- Replace lambda requirements with concrete Requirement implementations
- Fix TestScanner to implement close() method
- Update SiteReportRater constructor call with proper parameters
- Fix ExecutorConfig method calls (use setOutputFile with String)
- Update all references from getExecutedProbes() to getExecutedProbeTypes()
- Fix Guideline constructor to use 3 parameters
- Change List to Set for probe type collections in TestReport
- Add missing imports (HashSet, Set)
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.

1 participant