TW-1305 |
Build fails when using Code Coverage with TestNG |
|
0
|
|
TestNG fails when code coverage is switched on. Build succeeds with all tests passing when code coverage is switched off.
This is the output:
test.all (4s)
[mkdir] Created dir: /export/home/develop/buildAgent/work/My_Project/build/test
[test.all] path (<1s)
[test.all] taskdef (<1s)
[test.all] testng (4s)
[testng] Unit Tests (1s)
[testng] [Utils] FAILED TO CREATE CLASS class com.chaucerdigital.myproject.MyTest
Total tests run: 0, Failures: 0, Skips: 0
[testng] [ERROR]: java.lang.reflect.InvocationTargetException
[testng] The tests failed.
EMMA: Create Report (<1s)
[EMMA: Create Report] EMMA: processing control command sequence ...
[EMMA: Create Report] EMMA: executing [coverage.dump (,,true)] ...
[EMMA: Create Report] Unable to find /export/home/develop/buildAgent/work/My_Project/coverage.ec, cannot create EMMA report
Environment: Team City web server is on Windows Server 2003.
Build agent is on Solaris 10 (Sparc64).
Both have JDK 1.5
Using TestNG 5.1
Issue wasresolved
This is the output:
test.all (4s)
[mkdir] Created dir: /export/home/develop/buildAgent/work/My_Project/build/test
[test.all] path (<1s)
[test.all] taskdef (<1s)
[test.all] testng (4s)
[testng] Unit Tests (1s)
[testng] [Utils] FAILED TO CREATE CLASS class com.chaucerdigital.myproject.MyTest
=======================================
Unit TestsTotal tests run: 0, Failures: 0, Skips: 0
=======================================
[testng] [ERROR]: java.lang.reflect.InvocationTargetException
[testng] The tests failed.
EMMA: Create Report (<1s)
[EMMA: Create Report] EMMA: processing control command sequence ...
[EMMA: Create Report] EMMA: executing [coverage.dump (,,true)] ...
[EMMA: Create Report] Unable to find /export/home/develop/buildAgent/work/My_Project/coverage.ec, cannot create EMMA report
Environment: Team City web server is on Windows Server 2003.
Build agent is on Solaris 10 (Sparc64).
Both have JDK 1.5
Using TestNG 5.1
Issue wasresolved
org.testng.TestNGException:
Cannot instantiate class com.chaucerdigital.myproject.MyTest
at org.testng.internal.Utils.createInstance(Utils.java:481)
at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:59)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:81)
at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:69)
at org.testng.TestRunner.initMethods(TestRunner.java:246)
at org.testng.TestRunner.init(TestRunner.java:193)
at org.testng.TestRunner.init(TestRunner.java:163)
at org.testng.TestRunner.<init>(TestRunner.java:122)
at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:427)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:203)
at org.testng.SuiteRunner.run(SuiteRunner.java:168)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:969)
at org.testng.TestNG.runSuitesLocally(TestNG.java:933)
at org.testng.TestNG.run(TestNG.java:701)
at org.testng.TestNG.privateMain(TestNG.java:1001)
at org.testng.TestNG.main(TestNG.java:979)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at org.testng.internal.Utils.createInstance(Utils.java:472)
... 15 more
Caused by: java.lang.NoClassDefFoundError: com/vladium/emma/rt/RT
at com.chaucerdigital.myproject.MyNonTestClass.$VRi(MyNonTestClass.java)
at com.chaucerdigital.myproject.MyNonTestClass.<clinit>(MyNonTestClass.java)
at com.chaucerdigital.poker.myproject.MyTest.<init>(MyTest.java:14)
... 20 more
[testng] The tests failed.
EMMA: Create Report (5s)
[EMMA: Create Report] Unable to find /export/home/develop/buildAgent/work/My_Project/coverage.ec, cannot create EMMA report
[quote]
Thinking about this more I might see a possible problem:
the tests in order to gather the required data
If these 2 steps are using different classloader hierarchies then I
think there will be problems.
Can you help me with more details about what code coverage solution is
used in IDEA? Maybe I can further investigate the problem, but I would
definitely need to dig in the code to see what exactly are they doing.
If the problem comes from my above supposition then fixing it would be
quite tricky, but I may have a couple of ideas.
[/quote]
./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator
I'll try to investigate the problem in the nearest time.