| Summary: | port tycho-surefire to surefire 2.10 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Steffen Pingel <steffen.pingel> | ||||||||
| Component: | Tycho | Assignee: | Jan Sievers <jan.sievers> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | igor, jan.sievers, sochotnicky | ||||||||
| Version: | unspecified | ||||||||||
| Target Milestone: | --- | ||||||||||
| Hardware: | All | ||||||||||
| OS: | All | ||||||||||
| Whiteboard: | |||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 351100 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Steffen Pingel
Created attachment 201474 [details]
pom
Moving to Tycho since I have not been able to figure out why this is not working. We use the same pattern for all test bundles. We have configure a test suite in the pom that runs all JUnit tests. This works for a dozen test bundles except for org.eclipse.mylyn.java.tests which runs but no tests are executed. The error log is empty and running with -console shows that all required bundles resolve fine: osgi> diag org.eclipse.mylyn.java.tests initial@reference:file:../../ [64] No unresolved constraints. Is there any way to debug execution of the tycho-surefire-plugin further? I was able to work around it by changing the configuration to this:
<configuration>
<includes>
<include>**/AllJavaTests.class</include>
</includes>
</configuration>
Still, it's not clear to me why it doesn't work to configure the test suite explicitly for this bundle while it works for all other Mylyn test bundles.
please add 'mvn -X -e' debug log and link to source repository/CI build. How would that make a difference? The problem happens during execution of Eclipse and not in Maven. (In reply to comment #5) > How would that make a difference? The problem happens during execution of > Eclipse and not in Maven. as it says "no tests to run" it could be that the testrunner was misconfigured to include test(s) that don't exist. Created attachment 201503 [details]
log file
Here are the steps: # git clone ssh://git.eclipse.org/gitroot/mylyn/org.eclipse.mylyn.context.git # cd org.eclipse.mylyn.context/ # mvn -Dmaven.test.skip=true install # cd org.eclipse.mylyn.java.tests/ [edit pom.xml] # mvn -X -e integration-test I have attached the log output of the last command. The org.eclipse.mylyn.context/org.eclipse.mylyn.java.tests/target/surefire-reports/ directory is empty. (In reply to comment #8) the debug log says: [DEBUG] Using test framework org.junit4 but your test suite class http://git.eclipse.org/c/mylyn/org.eclipse.mylyn.context.git/tree/org.eclipse.mylyn.java.tests/src/org/eclipse/mylyn/java/tests/AllJavaTests.java is not annotated with @RunWith(Suite.class) => no tests are found. junit4 runner is used because you did not specify a version range to force version < 4 in the test bundle MANIFEST http://git.eclipse.org/c/mylyn/org.eclipse.mylyn.context.git/tree/org.eclipse.mylyn.java.tests/META-INF/MANIFEST.MF Require-Bundle: org.junit, and tycho will resolve junit to whatever it can get (junit 4 in this case). => Either explicitly require junit < 4 or port tests to junit 4 with annotations (and explicitly require junit >= 4). Let me know if this solves your issue. Thanks for the explanation. I am surprised that it works for the other Mylyn test bundles that don't have version ranges specified either. I tried adding this in the manifest but it did not make a difference: Require-Bundle: org.junit;bundle-version="[3.8.2,4.0.0)" I tried adding another class with JUnit 4 annotations without any luck but I might have not used the annotations correctly: @RunWith(Suite.class) @SuiteClasses(AllJavaTests.class) Anyways, feel free to mark this as workforme. The work around in comment#3 works fine. By default, Tycho includes=**/Test*.class,**/*Test.class,**/*TestCase, which does not match AllJavaTests.class afaict. Also, I have local branch that allows forcing use of junit v3 launcher for projects that depend on junit v4. I can merge it to master if anyone is interested. Forcing the junit v3 launcher by specifying a version range in the test plugin works fine. after some in-depth debugging, I found the problem: it's actually a bug in surefire http://jira.codehaus.org/browse/SUREFIRE-638 surefire can't handle "java" in includes :( ... and here we have org/eclipse/mylyn/java/tests/AllJavaTests.class which surefire converts to org/eclipse/mylyn/class/tests/AllJavaTests.class ^^^^^ (instead of only replacing ".java" at the end of the String only if found) and this class of course can't be found. => we should update the surefire version used by tycho to >= 2.7 where this bug is fixed. Wow, great find! That explains why the java tests bundle was the only broken one. Thanks for digging into this. Created attachment 201728 [details] patch to port tycho-surefire to surefire 2.9 patch which ports tycho-surefire to surefire 2.9 I attach it as patch and don't submit it because 1. we will need to file CQs for surefire 2.9 and I don't want to further delay initial check-in 2. 2 classes are still copied from surefire-junit3 instead of fixing a bug in surefire The hard part was to find out why code was originally copied from surefire-junit. Turns out the reason why the code was copied is a bug with suite classes (see patch) which it seems was never reported and thus still exists in latest surefire 2.9 :( I will report it at http://jira.codehaus.org/browse/SUREFIRE The patch fixes the issue again by copying but I would prefer we fix it in surefire. waiting for surefire 2.10 which will include my fix for http://jira.codehaus.org/browse/SUREFIRE-761 *** Bug 359044 has been marked as a duplicate of this bug. *** (In reply to comment #16) surefire 2.10 released http://maven.40175.n5.nabble.com/Maven-Surefire-2-10-Released-td4858384.html fixed with commit http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=a4248738bbbb53f30f1a213b2829c5344c0988fb I will open CQs for surefire 2.10 artifacts (In reply to comment #19) CQs 5739, 5741, 5743, 5740, 5742 opened for surefire 2.10 (In reply to comment #20) > CQs 5739, 5741, 5743, 5740, 5742 > > opened for surefire 2.10 All CQs have been approved. |