0

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?

  • What is that `/data2/pcf/Yucca/config/components/smoke/ArchiveApi.xml`? Is it correct, is it surely the same as on windows? Is it really on that location? – peterh Aug 16 '19 at 17:55
  • Yes, its same as on windows. In windows its ingoring the capitalize formats, but in Linux it dont. – Manigandan Seetharaman Aug 18 '19 at 08:05
  • Check [this](https://github.com/apache/maven-surefire/blob/master/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXmlTestSuite.java). This is the source code of the maven plugin, throwing that exception. It says: `if ( !suiteFile.isFile() ) { ... }` Do you see that, in the line 96? It says, that this file simply does not exist. – peterh Aug 18 '19 at 16:34
  • Btw, the JDK is a little bit uncommon in this sense. It says "not a file" even if it is a file, but the process has no permission to open it. What is the output of a `strace -s 4096 -f mvn clean test -Dtestng.suite.xml.file=config/components/smoke/testSmoke.xml 2>&1|grep -F ArchiveApi.xml` command? It would trace, what is doing your JVM on the kernel call level with anything having `ArchiveApi.xml` as substring. – peterh Aug 18 '19 at 20:02

1 Answers1

0

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
                                                                   ^^^^^
Greg Burghardt
  • 17,900
  • 9
  • 49
  • 92