-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Report discovery issues for @Suite
classes
#4429
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces enhanced reporting for discovery issues related to @suite classes. Key changes include:
- Reporting discovery issues for invalid suite classes and cyclic suite configurations.
- Adding precondition checks and message prefixing for discovery issues.
- Updating test cases and internal helper classes to support the new discovery issue reporting mechanism.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/ErroneousTestCase.java | Added test case with non-static lifecycle method to simulate erroneous behavior. |
platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/ErroneousTestSuite.java | Introduced a suite that selects the erroneous test case. |
platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SuiteWithErroneousTestSuite.java | Provided a suite that includes the erroneous test suite. |
platform-tests/src/test/java/org/junit/platform/engine/DiscoveryIssueTests.java | Added tests for the DiscoveryIssue.withMessage functionality. |
junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsSuiteClass.java | Refactored suite class eligibility checks to use combined conditions reporting issues. |
platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteEngineTests.java | Updated suite engine tests to check for proper reporting of discovery issues. |
junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoveryIssue.java | Extended the DiscoveryIssue API with a new withMessage method for message modification. |
junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java | Introduced a DiscoveryIssueForwardingListener and adjusted constructor signatures for enhanced reporting. |
junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/DiscoverySelectorResolver.java | Modified selector resolution to inject a discovery listener and issue reporter. |
junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java | Added a listener method to the discovery request builder. |
junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java | Updated to use the discovery listener and issue reporter when handling cycles. |
platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteTestDescriptorTests.java | Adjusted test construction to match updated production code requirements. |
junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsPotentialTestContainer.java | Removed unused code in favor of updated suite class checks. |
Comments suppressed due to low confidence (3)
platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteEngineTests.java:142
- [nitpick] The expected error message in this test is tightly coupled to its formatting. Consider refactoring the error message formatting into a shared constant or helper method to ensure consistency with the discovery issue reporter and reduce brittleness in the tests.
var message = "@Suite class '%s' must not be private.".formatted(PrivateSuite.class.getName());
junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java:111
- [nitpick] To improve maintainability, consider defining a constant for the cycle detection message format. This ensures consistent reporting of cycle issues across the codebase and simplifies future updates if the message needs to change.
if (containsCycle(id)) {
platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteTestDescriptorTests.java:55
- [nitpick] Ensure that the mock EngineDiscoveryListener provided in this test sufficiently simulates realistic listener behavior. Additionally, consider adding tests that cover listener-related logic to match production expectations.
outputDirectoryProvider, mock(), discoveryIssueReporter);
@mpkorstanje Do you have time to take a look at this PR? |
junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsSuiteClass.java
Show resolved
Hide resolved
junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsSuiteClass.java
Outdated
Show resolved
Hide resolved
...platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java
Outdated
Show resolved
Hide resolved
junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoveryIssue.java
Show resolved
Hide resolved
junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsSuiteClass.java
Outdated
Show resolved
Hide resolved
@mpkorstanje Thanks for your review! |
The ID of the engine the issue originated from is now used to prefix issues encountered during discovery of `@Suite` classes.
d739292
to
5615e0b
Compare
Overview
@Suite
classes@Suite
classIssue: #242
I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@API
annotationsChange is documented in the User Guide and Release Noteswill be done in a later PR