Skip to content

Analyze test classes optionally if the user wants to #125

@rahlk

Description

@rahlk

Is your feature request related to a problem? Please describe.

Currently, the codeanalyzer-java does not account for test classes (src/test/java/) when analyzing a Maven project. This leads to missing information from unit tests, which can be essential for understanding dependencies, call graphs, and other structural insights in a codebase.

Describe the solution you’d like

The tool should recognize and process test classes located in src/test/java/, ensuring they are included in relevant analyses. Specifically, it should:

  • Detect test classes and compile them if necessary.
  • Include test-related call sites and dependencies in the analysis.
  • Maintain a distinction between main source files (target/classes/) and test files (target/test-classes/).

Add a new flag --include-test-classes that optionally enable mvn test-compile instead of mvn compile (or the gradle alternative)

Describe alternatives you’ve considered

  • Manually copying test classes to the main source directory before running the tool (not ideal).
  • Running a separate analysis phase for test files.
  • Using custom workarounds to merge test and main class data post-analysis.

Additional context

Handling test classes is crucial for tools that analyze code structure, call graphs, and dependencies since test cases often contain critical references to core logic. Support for this feature would improve the completeness of the analysis.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions