--
You received this message because you are subscribed to the Google Groups "testng-users" group.
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.
> I think I figured it out.
>
> Because pom's can't have circular dependencies, I need to use two different pom's for TestNG: one to build everything but not run the tests (pom.xml) and one to just run the tests (pom-test.xml).
>
> In order for this to work, pom-test.xml needs to be exactly one version ahead of pom.xml.
>
> When I pushed 5.14.1, I updated pom.xml but I think I forgot to update pom-test.xml, which was therefore still running against 5.14.
>
> I should probably think of way to verify this in the build.
>
> I just pushed 5.14.2, which should solve the problem, try it and let me know.
It resolves that particular problem.
I've rejigged the Surefire integration tests to see what other regressions could be detected. There are 3, all starting in 5.13:
1) In 5.12.1, the following gives an error due to the cycle:
@Test(groups = { "test" }, dependsOnGroups = { "test" })
In 5.13.1+, the test is skipped. Is that intentional? One of the test cases was using it to test what happens when TestNG fails early.
2) In 5.12.1, the following is valid configuration:
<property><name>listener</name><value>listenReport.ResultListener,listenReport.SuiteListener</value></property>
<property><name>reporter</name><value>listenReport.Reporter</value></property>
In 5.13.1+, the API has changed such that both expect to be an ArrayList instead of a String. Can TestNG do an instanceof check and convert if the "old" string mechanism is used?
3) Likewise,
<threadCount>3</threadCount>
is passed in as a String (and there is one more example though we don't have a test for it). This causes a class cast exception, expecting an integer. Likewise, can it be converted?
- Brett
svn co http://svn.apache.org/repos/asf/maven/surefire/trunk surefire
cd surefire
mvn clean install -Dtestng.version=5.14.2
You can use that for versions back to TestNG 4.7 I think to compare results. In the future I'll probably set the individual tests to only run on the ones they are known to work for.
Cheers,
Brett
--
Brett Porter
br...@apache.org
http://brettporter.wordpress.com/
It resolves that particular problem.
>
> I just pushed 5.14.2, which should solve the problem, try it and let me know.
I've rejigged the Surefire integration tests to see what other regressions could be detected. There are 3, all starting in 5.13:
1) In 5.12.1, the following gives an error due to the cycle:
@Test(groups = { "test" }, dependsOnGroups = { "test" })
In 5.13.1+, the test is skipped. Is that intentional? One of the test cases was using it to test what happens when TestNG fails early.
2) In 5.12.1, the following is valid configuration:
<property><name>listener</name><value>listenReport.ResultListener,listenReport.SuiteListener</value></property>
<property><name>reporter</name><value>listenReport.Reporter</value></property>
In 5.13.1+, the API has changed such that both expect to be an ArrayList instead of a String. Can TestNG do an instanceof check and convert if the "old" string mechanism is used?
Object listeners = cmdLineArgs.get(CommandLineArgs.LISTENER);
if (listeners instanceof List) {
result.listener = Utils.joinClasses((List<Class>) listeners, " ");
} else {
result.listener = (String) listeners;
}
String reporterConfigs = (String) cmdLineArgs.get(CommandLineArgs.REPORTERS_LIST);
if (reporterConfigs != null) {
result.reportersList = reporterConfigs;
}
3) Likewise,
<threadCount>3</threadCount>
is passed in as a String (and there is one more example though we don't have a test for it). This causes a class cast exception, expecting an integer. Likewise, can it be converted?
String threadCount = (String) cmdLineArgs.get(CommandLineArgs.THREAD_COUNT);
if (threadCount != null) {
result.threadCount = Integer.parseInt(threadCount);
}
I've rejigged the Surefire integration tests to see what other regressions could be detected. There are 3, all starting in 5.13:
1) In 5.12.1, the following gives an error due to the cycle:
@Test(groups = { "test" }, dependsOnGroups = { "test" })
In 5.13.1+, the test is skipped. Is that intentional? One of the test cases was using it to test what happens when TestNG fails early.I don't think there was any change in that area, but something that could have caused the change in behavior is whether there used to be more than one method in the group "test" and now there is only one. Do you think you might have done that in your test?I agree it's not an intuitive behavior, though, and more specifically, the bug is that when TestNG only finds one test method, it just skips the sorting phase (why sort if there's only one method?). However, it's the sorting phase that detects cycles :-)
2) In 5.12.1, the following is valid configuration:
<property><name>listener</name><value>listenReport.ResultListener,listenReport.SuiteListener</value></property>
<property><name>reporter</name><value>listenReport.Reporter</value></property>
In 5.13.1+, the API has changed such that both expect to be an ArrayList instead of a String. Can TestNG do an instanceof check and convert if the "old" string mechanism is used?You are right about the first observation, and the code now does:Object listeners = cmdLineArgs.get(CommandLineArgs.LISTENER);
if (listeners instanceof List) {
result.listener = Utils.joinClasses((List<Class>) listeners, " ");
} else {
result.listener = (String) listeners;
}
However, for reporters, TestNG still seems to expect a string:String reporterConfigs = (String) cmdLineArgs.get(CommandLineArgs.REPORTERS_LIST);
if (reporterConfigs != null) {
result.reportersList = reporterConfigs;
}Can you double check in TestNGMapConfigurator?
Speaking of this class: it doesn't seem to be consistent with the way TestNG supports and parses collections of the same property. For example, it looks like you can only specify one listener with Surefire, or did I misread the code? (didn't look too deep)
3) Likewise,
<threadCount>3</threadCount>
is passed in as a String (and there is one more example though we don't have a test for it). This causes a class cast exception, expecting an integer. Likewise, can it be converted?Sure (and there's indeed a TODO comment in the TestNG code about that, although I can't recall if I wrote it or if someone else did).
Since I seem to release more often than Surefire, I guess I should make the change to string for now. Down the line, we should modify Surefire to invoke the new configure() method (the one that accepts a CommandLineArgs class), which is much safer from a typing standpoint.
[...]
I also notice that Surefire doesn't seem to support "-dataproviderthreadcount", but I added support for it in TestNG anyway.
The subsequent split call uses ';' or ',', not ' ' - so the above code causes the following:Cannot load class from file: listenReport.ResultListener listenReport.SuiteListenerat org.testng.internal.ClassHelper.fileToClass(ClassHelper.java:464)at org.testng.TestNG.configure(TestNG.java:1182)at org.testng.TestNG.configure(TestNG.java:1343)at org.apache.maven.surefire.testng.conf.TestNGMapConfigurator.configure(TestNGMapConfigurator.java:97)If " " is changed to "," all the tests pass.
I also notice that Surefire doesn't seem to support "-dataproviderthreadcount", but I added support for it in TestNG anyway.Actually, Surefire stopped adding TestNG specific parameters to its configuration after the initial set. When Alex implemented the map configurator, we added a <properties> element to Surefire that let's you pass in any argument you want (such as the above).It's intentional that we shouldn't have to release a new Surefire every time that TestNG comes out, so that users can choose which version suits them for TestNG.I like the idea of CommandLineArgs variant, especially if we can expose that to the plugin configuration so users can get better feedback on the right args to use. But we have to be careful about binding Surefire to a particular TestNG release.
> I think this last point is the deal breaker. Even if it means more work for me, I think it's safer to keep going with the first option because TestNG releases more often than Surefire. I just need to remember to update the two configure() methods whenever I add a new parameter.
>
> Is my analysis correct?
I think so, but let me take a look and see if there's anything I could work out to get CommandlineArgs into newer versions.
- Brett