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
Unit Tests
Total tests run: 0, Failures: 0, Skips: 0
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
As requested, set verbose to 9, only additional output was a list of classes skipped (all correct) and the full stack-trace for the error. Looks like it can't find the EMMA classes.
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.TestRunner.initMethods(TestRunner.java:246)
at org.testng.TestRunner.init(TestRunner.java:193)
at org.testng.TestRunner.init(TestRunner.java:163)
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)
... 20 more
This is the comment I have posted on TestNG ML:
[quote]
Thinking about this more I might see a possible problem:
- code coverage tools may need to use a special class loader to weave
the tests in order to gather the required data
- TestNG loads the test classes through reflection mechanism
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
| Old | New | |
| Daniel Dyer (dwdyer) - 20 months ago (15 Jan 2007 16:10) | ||
Kirill Maximov (maxkir)
21 months ago (09 Dec 2006 13:45)Could you please try verbose="9" in your testng.xml configuration and attach full build log text with this setting enabled?