[GRADLE-538] Test detection seems to think that every class under src/test/java is a test class Created: 11/Jul/09 Updated: 04/Jan/13 Resolved: 13/Jul/09 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 0.6.1 |
Fix Version/s: | 0.7 |
Type: | Bug | ||
Reporter: | Peter Niederwieser | Assignee: | Tom Eyckmans |
Resolution: | Fixed | Votes: | 0 |
Attachments: | gradletest.zip | ||||||||
Issue Links: |
|
Description |
Unzip the attached sample project and run gradle clean test. Side notes:
|
Comments |
Comment by Tom Eyckmans [ 12/Jul/09 ] |
Hi Peter, Thanks for pointing this out, this is odd behavior indeed. I've checked this out and the test detection is working properly (no test classes detected), in debug logging it is also visible that the classes are discarded: The includes/excludes passed to the Ant JUnit/TestNG task end up empty which cause JUnit / TestNG to include all classes in the test run (which I didn't anticipate). Possible solution -> skip test execution and fail the build (can be disabled) - also put this up for discussion on the dev list, feedback more welcome. Regarding your comment on the dependencies section in the build file, we don't automatically add dependencies (so you are alway in control) so yes you always need to specify a junit / testng dependency. This is normally not an issue since you need to include junit / testng in the testCompile dependency configuration because otherwise the test won't compile. I've mentioned the unreleased version issue to Hans, waiting for feedback on that. |
Comment by Peter Niederwieser [ 13/Jul/09 ] |
> we don't automatically add dependencies (so you are alway in control) > so yes you always need to specify a junit / testng dependency. This is normally not an issue since you need to include junit / testng in the testCompile dependency configuration because otherwise the test won't compile. I think Gradle should be more graceful here. Say I'm using a test framework that's not yet supported by Gradle and which doesn't depend on JUnit. Then it's certainly OK for Gradle not to run my tests, but it shouldn't crash either. Another scenario is that I've only written a test helper class so far and not yet added the JUnit dependency. Again, Gradle shouldn't crash. |
Comment by Tom Eyckmans [ 13/Jul/09 ] |
Hi Peter, When no test are found by the test detection (based on class files scanning and/or includes/excludes) the test execution is skipped, this also solves the issue when there are only support classes in the test sources because the JUnit task is not executed and therefore the JUnit dependency is not needed. This results in an empty JUnit report and no report in case of TestNG. |