TestNG 6.2

703 views
Skip to first unread message

Cédric Beust ♔

unread,
Aug 18, 2011, 3:39:00 PM8/18/11
to testng...@googlegroups.com
Hi everyone,

I just pushed TestNG 6.2 to Maven Central and http://testng.org and I will be announcing it officially shortly. Please let me know if you find any problems (or if you don't find any :-)) with this new version.

Here is the change log:

Added: xmlpathinjar to the TestNG ant task
Added: TestNG can now invoke package protected constructors
Added: Injectors created by the @Guice annotation are now shared at the <test> level
Added: IConfigurationListener is now a public listener, along with a new one: IConfigurationListener2
Added: When a method fails, only dependents of the same instance will be skipped
Added: parallel=instances for factory instance parallel runs
Added: @Factory(enabled)
Fixed: JUnitReports reports now report the cumulated time @{Before,After}Method+@Test for each test method
Fixed: JUnitReports reports have the name of the <test> instead of that of the first class
Fixed: Using preserve-order with a factory that creates instances of a different class causes NPE
Fixed: GITHUB-74: Bad ordering of test methods when using a @Factory constructor with dataProvider
Fixed: Changing the test result from success to failure in a listener would still count the test as a success
Fixed: ServiceLoader wasn't resolving correctly if no service loader classloader was specified
Fixed: Better ordering with mixed priorities and dependencies
Fixed: Improved detection of graph cycles in parallel runs
Fixed: @BeforeTest was invoked multiple times if a factory is used
Fixed: GITHUB-57: Allow usage of package protected constructor of test classes
Fixed: Injecting both Object[] and Method in @BeforeMethod didn't always work
Fixed: testng-results.xml now lists the results chronologically
Fixed: @Listeners specified on a base class will only be run once per listener class (dbriones)
Fixed: -groups and -excludegroups were no longer overriding testng.xml

Eclipse:

Added: Each data provider method now has a separate node entry in the TestNG view
Fixed: Nodes in error would sometimes remain green
Fixed: The TestNG context menu no longer appears where it shouldn't

-- 
Cédric


charris

unread,
Aug 18, 2011, 8:06:42 PM8/18/11
to testng...@googlegroups.com
Actually, I found one issue:

In Eclipse, the Method level node remains green when there are some failed data provider entries. So I wind up with Red Suite/Test/Class - Green Method - 9 Green dataProvider and 3 red dataProvider entries.

Cédric Beust ♔

unread,
Aug 18, 2011, 8:26:19 PM8/18/11
to testng...@googlegroups.com
I fixed this not long ago, are you using the latest plug-in? If yes, then please email me a short test case so I can reproduce the problem.

Thanks.

-- 
Cédric




On Thu, Aug 18, 2011 at 5:06 PM, charris <cheryl...@gmail.com> wrote:
Actually, I found one issue:

In Eclipse, the Method level node remains green when there are some failed data provider entries. So I wind up with Red Suite/Test/Class - Green Method - 9 Green dataProvider and 3 red dataProvider entries.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/bSm8ea0lGScJ.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Abraham Lin

unread,
Aug 19, 2011, 12:44:40 PM8/19/11
to testng...@googlegroups.com
I came across two bugs with the newest version.

The first is with regard to overriding the groups to be run in testng.xml. While the override does now occur with 6.2, the override only appears to be applied to the first test element specified in testng.xml (see attached testng-groups.zip). You can compare the testng.xml and the "naked classes" behavior by specifying the "suitexml" and "classes" profiles, respectively.

The second bug is with regard to how dependent group names are handled. In 6.1.1, the value of the "dependsOnGroups" attribute was treated as a regular expression and so meta-characters like '.' had to be escaped. In 6.2, it appears that the attribute is treated verbatim (i.e. to achieve the same behavior as in 6.1.1, meta-characters cannot be escaped; regular expressions also are not treated as such). Using the attached testng-depends.zip, you can contrast the behaviors of 6.1.1 and 6.2 using the "6.1.1" and "6.2" profiles, respectively.

Thanks!


2011/8/18 Cédric Beust ♔ <ced...@beust.com>

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
testng-groups.zip
testng-depends.zip

Cédric Beust ♔

unread,
Aug 19, 2011, 12:50:32 PM8/19/11
to testng...@googlegroups.com
Hi Abraham,

Your first bug might be correct since I made a few changes in this area, but I'm puzzled by the second one since I haven't touched that part in a while.

I'll look into both, thanks!

-- 
Cédric

charris

unread,
Aug 19, 2011, 1:58:54 PM8/19/11
to testng...@googlegroups.com
Ahhh, it appears it only happens sometimes! I've attached a simple test file. It will always be 50% passing. Run it a bunch of times,  sometimes the method level will be red, sometimes green. It appears that it all depends on if the the LAST dataProvider entry listed is red or green - the method matches that.

I'm running plugin 6.1.1.20110810_0944.

ZTestNGDisplayFailures.java

Venu Kemthur

unread,
Aug 22, 2011, 11:32:23 AM8/22/11
to testng...@googlegroups.com
I get this error with 6.2

org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:104)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)
Caused by: java.lang.NullPointerException
at org.testng.TestRunner.createClassDependencies(TestRunner.java:1182)
at org.testng.TestRunner.createDynamicGraph(TestRunner.java:1079)
at org.testng.TestRunner.privateRun(TestRunner.java:725)
at org.testng.TestRunner.run(TestRunner.java:614)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:335)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:330)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
at org.testng.SuiteRunner.run(SuiteRunner.java:241)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1169)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1094)
at org.testng.TestNG.run(TestNG.java:1006)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:122)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:101)
... 9 more


TestNG file that I use has a layout like this:

<test name="test1">
<classes>
<class name="com.venu.TestClass1" />
<class name="com.venu.TestClass2" />
</classes>
</test>

I am trying to execute a test case which is in one of the test classes (TestClass1) by specifying the group param in command line
Tried to debug on what exactly is going on in createClassDependencies() but couldn't make much of it :)

if (index != null && index > 0) {
        // Make this method depend on all the methods of the class in the previous
        // index
        String classDependedUpon = indexedClasses2.get(index - 1);
        List<ITestNGMethod> methodsDependedUpon = methodsFromClass.get(classDependedUpon);
        for (ITestNGMethod mdu : methodsDependedUpon) {
          result.put(mdu, m);
        }
      }

It seems to fetch a class via indexedClasses2.get(), however methodsFromClass.get() on the returned value returns null !

-- Venu


From: Cédric Beust ♔ <ced...@beust.com>
To: testng...@googlegroups.com
Sent: Friday, August 19, 2011 1:09 AM
Subject: [testng-users] TestNG 6.2

Yury Kryazhev

unread,
Aug 24, 2011, 4:27:06 AM8/24/11
to testng-users
Hi Cédric!

I've got exception because of guice dependency, why it's marked as
<scope>provided</scope> ?

Truly,
Yury

Cédric Beust ♔

unread,
Aug 24, 2011, 12:58:12 PM8/24/11
to testng...@googlegroups.com
Because including Guice inside TestNG causes version problems.

If you are going to use the Guice support in TestNG, you most likely already have it in your classpath, hence `provided`.

-- 
Cédric




Cédric Beust ♔

unread,
Aug 24, 2011, 12:57:03 PM8/24/11
to testng...@googlegroups.com, Venu Kemthur
Venu, can you email me your two classes so I can try to reproduce the problem?

Thanks.

-- 
Cédric

Mark Derricutt

unread,
Aug 26, 2011, 12:34:24 AM8/26/11
to testng...@googlegroups.com
You broke my tests! Wahhhhhhh.

Seriously - you just uncovered a broken test/piece of code that referred to a static field, that had been mocked out by a previous test, and started breaking when things mysteriously ran in a different order to every run for the last 2 years or so :)

Strangely tho, when I reverted the version of TestNG I still got the same issue.  Updated test and a new you track ticket to refactor a chunk of code later and I'm all green again :-)

Mark

Cédric Beust ♔

unread,
Aug 26, 2011, 12:39:47 AM8/26/11
to testng...@googlegroups.com
Good to hear it. It's a bit mysterious, though, are you sure it's not another factor that coincided with you upgrading to 6.2? (e.g. new JDK or something like that?).

-- 
Cédric




Mark Derricutt

unread,
Aug 26, 2011, 12:43:03 AM8/26/11
to testng...@googlegroups.com
Not that I can think of as it was the build server that alerted me to the fact ( sigh yes, I changed testng and committed without actually running the tests locally :( ).

All very confusing.

martino

unread,
Sep 1, 2011, 10:11:54 AM9/1/11
to testng-users
HI all,

I have the same Exception:
Caused by: java.lang.NoClassDefFoundError: com/google/inject/Module
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.privateGetPublicMethods(Class.java:2547)
at java.lang.Class.getMethods(Class.java:1410)
at
org.apache.velocity.util.introspection.ClassMap.getAccessibleMethods(ClassMap.java:
258)
at
org.apache.velocity.util.introspection.ClassMap.populateMethodCache(ClassMap.java:
151)
at
org.apache.velocity.util.introspection.ClassMap.<init>(ClassMap.java:
64)
at
org.apache.velocity.util.introspection.IntrospectorBase.createClassMap(IntrospectorBase.java:
126)
at
org.apache.velocity.util.introspection.IntrospectorBase.getMethod(IntrospectorBase.java:
112)
at
org.apache.velocity.util.introspection.Introspector.getMethod(Introspector.java:
100)
at
org.apache.velocity.runtime.parser.node.PropertyExecutor.discover(PropertyExecutor.java:
65)
at
org.apache.velocity.runtime.parser.node.PropertyExecutor.<init>(PropertyExecutor.java:
39)
at
org.apache.velocity.util.introspection.UberspectImpl.getPropertyGet(UberspectImpl.java:
156)
at
org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:
125)
at
org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:
175)
at
org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:
327)
at
org.apache.velocity.runtime.parser.node.ASTAddNode.value(ASTAddNode.java:
66)
at
org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:
51)
at
org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:
95)
at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:
55)
at
org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:
114)
at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:
55)
at
org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:
114)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:
230)
at org.apache.velocity.Template.merge(Template.java:256)
at
org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:449)
at
org.uncommons.reportng.AbstractReporter.generateFile(AbstractReporter.java:
108)
at
org.uncommons.reportng.HTMLReporter.createOverview(HTMLReporter.java:
142)
at
org.uncommons.reportng.HTMLReporter.generateReport(HTMLReporter.java:
107)
at org.testng.TestNG.generateReports(TestNG.java:1064)
at org.testng.TestNG.run(TestNG.java:1023)
at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:
122)
at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:
92)
at
org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:
101)
... 9 more
Caused by: java.lang.ClassNotFoundException: com.google.inject.Module
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:
301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 45 more


but only when I use reportNG

Any idea?

Thanks

martino

unread,
Sep 1, 2011, 1:36:38 PM9/1/11
to testng-users
Thanks to dwdyer I got a solution:

just add guice-3.0.jar to the classpath or as maven dependency and it
will fix it!
Reply all
Reply to author
Forward
0 new messages