Kirill Kozlov created SUREFIRE-1062:
---------------------------------------
Summary: TestNG listeners on separate lines in pom.xml
Key: SUREFIRE-1062
URL: https://jira.codehaus.org/browse/SUREFIRE-1062
Project: Maven Surefire
Issue Type: Improvement
Components: TestNG support
Affects Versions: 2.16
Reporter: Kirill Kozlov
Priority: Minor
Currently, maven-surefire-plugin doesn't support setting TestNG listeners on
the separate lines in pom.xml. User must put all listeners at the same line, so
the line becomes very long.
For example, for the following configuration the plugin throws unclear
exception. It's very hard to determine the reason, cause the first idea is that
something wrong with your classpath.
{code}
...
<property>
<name>listener</name>
<value>
com.company1.testng.listeners.Listener1,
com.company2.testng.listeners.Listener2
</value>
</property>
...
{code}
{code}
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on
project allure-testng-example: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:2.16:test failed: There was an
error in the forked process
[ERROR] org.apache.maven.surefire.testset.TestSetFailedException: Cannot find
listener class
[ERROR] com.company2.testng.listeners.Listener2; nested exception is
java.lang.ClassNotFoundException:
[ERROR] com.company2.testng.listeners.Listener2
[ERROR] java.lang.ClassNotFoundException:
[ERROR] ru.befree.qa.tools.testng.listeners.LoggerListener
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[ERROR] at java.lang.Class.forName0(Native Method)
[ERROR] at java.lang.Class.forName(Class.java:190)
[ERROR] at
org.apache.maven.surefire.testng.conf.AbstractDirectConfigurator.loadClass(AbstractDirectConfigurator.java:139)
[ERROR] at
org.apache.maven.surefire.testng.conf.AbstractDirectConfigurator.loadListenerClasses(AbstractDirectConfigurator.java:127)
[ERROR] at
org.apache.maven.surefire.testng.conf.TestNGMapConfigurator.getConvertedOptions(TestNGMapConfigurator.java:81)
[ERROR] at
org.apache.maven.surefire.testng.conf.TestNG652Configurator.getConvertedOptions(TestNG652Configurator.java:40)
[ERROR] at
org.apache.maven.surefire.testng.conf.TestNGMapConfigurator.configure(TestNGMapConfigurator.java:52)
[ERROR] at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:214)
[ERROR] at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84)
[ERROR] at
org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:92)
[ERROR] at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
[ERROR] at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
[ERROR] at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
[ERROR] -> [Help 1]
{code}
Is it a problem to fix AbstractDirectConfigurator class to split the value of
*listener* property using new line symbols too?
Current implementation is:
{code}
String[] classNames = listenerClasses.split( " *, *" );
{code}
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)