我从命令行运行测试套件时遇到问题。
java -jar test.jar
java.io.FileNotFoundException: /home/user01/jenkins/run_suite/test-suites/test.xml (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at org.testng.xml.Parser.parse(Parser.java:167)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:302)
at org.testng.TestNG.run(TestNG.java:991)
[TestNG] [ERROR] No test suite found. Nothing to run
Usage: <main class> [options] The XML suite files to run
但如果我查看目录
[user01@xxxx ~]$ ll /home/user01/jenkins/run_suite/test-suites/test.xml
-rwxrwxrwx 1 user01 user01 233 Apr 7 16:07 /home/user01/jenkins/run_suite/test-suites/test.xml
我已将更改权限更改为777
chmod -R 777 /home/user01/jenkins/
但没有帮助。从eclipse
执行相同的test.xml套件没有问题答案 0 :(得分:0)
我发现了这个问题:)
因为我的文件“test.xml”已由
更新sed -i 's/\(testSuite = \)/\1test-suites\/test_suite.xml/' test.xml
我注意到在我删除空间问题后,我在最后一行有空格,所以我运行以下命令
sed -i 's/\s*$//' test.xml
现在工作:)