Search code examples
mavenautomationtestngbddsuite

TestSetFailedException only on Linux


We are trying to run the testng file through maven command. The testng file name: testSMOKE.xml.

The maven command:

mvn clean test -Dtestng.suite.xml.file=config/components/smoke/testSmoke.xml

The command works in Windows machines, but the same command did not work in linux machines due to the filename of the test suite.

Exception:
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[ERROR] Caused by: org.apache.maven.surefire.testset.TestSetFailedException: Suite file /data2/pcf/Yucca/config/components/smoke/testSmoke.xml is not a valid file
[ERROR]         at org.apache.maven.surefire.testng.TestNGXmlTestSuite.locateTestSets(TestNGXmlTestSuite.java:99)
[ERROR]         at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:119)
[ERROR]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.lang.reflect.Method.invoke(Method.java:498)

What is the difference here?


Solution

  • In Windows file names are not case sensitive, so testSMOKE.xml = testSmoke.xml.

    In Linux, file names are case sensitive, so testSMOKE.xml and testSmoke.xml are different files. Make sure your command line argument matches the file name in a case sensitive match:

    mvn clean test -Dtestng.suite.xml.file=config/components/smoke/testSMOKE.xml
                                                                       ^^^^^