How saeg/jaguar2 works
Main components and modules
• API Module (jaguar2-api): This defines the overall public interfaces such as Spectrum-related interfaces (e.g., IBundleSpectrum, IClassSpectrum, ICodeSpectrum, etc.), as well as the heuristic contract (Heuristic, SpectrumEval). It sets the contract for how coverage controllers and spectrum exporters should behave.
• Core Module (jaguar2-core): Contains the core computation logic, including the main Jaguar engine and different heuristics (DRT, Jaccard, Kulczynski2, McCon, Minus, Ochiai, Op, Tarantula, Wong3, Zoltar). This is the processing heart of the system.
• Commons Module (jaguar2-commons): Offers utility classes and common functionality that is shared among the other modules.
• Build Module (jaguar2-build): Provides infrastructure to handle the build aspects specific to Jaguar2.
• Exporters Modules (jaguar2-exporters): Contains different submodules (CSV and XML exporters) that implement the SpectrumExporter SPI to deliver coverage data in various formats.
• Providers Modules (jaguar2-providers): Provides multiple coverage provider implementations (such as the Ba-Dua and JaCoCo providers) that plug into the system through the SPI mechanism. Note the use of META-INF/services files that help with dynamic discovery.
• Integration Modules (jaguar2-junit4, jaguar2-examples): Supply integration examples and JUnit-based test runners that demonstrate how Jaguar2 can be consumed in a testing context.
• Tests and Validations (jaguar2-tests & jaguar2-validations): Organized tests validating the functionality across API, core, commons, and integration points.
• CI/CD and Build System: The presence of Maven wrapper files, GitHub Actions configuration (in .github/workflows), and various pom.xml files in each module indicates an emphasis on automated builds and continuous integration.
Relationships and interactions
• The API module provides the interfaces and contracts that the other components adhere to.
• The Core module implements the logic required to perform spectrum evaluations using various heuristics. It interacts with the API by invoking defined interfaces.
• The Providers modules implement the CoverageController and SpectrumExporter interfaces (using Java SPI via the META-INF/services) to integrate external coverage tools, making them pluggable.
• The Exporters modules (CSV and XML) read the processed spectrum data from the core and export it in different formats.
• The Commons module acts as a support library which other modules (like Core and Providers) rely on.
• The integration modules (Junit4 and examples) demonstrate how the system is used in real testing scenarios, utilizing the API, Core, and installed providers.
• The Tests modules ensure that each component is correctly validating its functionality, acting as both unit and integration tests.
• The Build and CI/CD configuration ensures that the entire system is seamlessly built, tested, and deployed.
Architectural patterns and design principles
• Modular / Multi-Module Architecture: Each separate concern is isolated in its own Maven module, which makes for loose coupling and clearer separation of concerns.
• Service Provider Interface (SPI) Pattern: The use of META-INF/services for components like SpectrumExporter and CoverageController illustrates the plug-in architecture that allows for third-party extension.
• Integration with External Tools: There is clear support for integrating with external coverage tools (e.g., JaCoCo) and testing frameworks (JUnit integrated modules), following standard integration practices.
• Dependency Injection / Inversion of Control: Though not explicitly stated, the SPI mechanism implies an inversion of control by allowing providers to be discovered and used dynamically.
Final recommendations for the principal software engineer
• Be explicit in showing the flow: from coverage data input (via tests) to core evaluation, then dispatching to exporters and integration with external tools.