从 Jenkins 发出 运行 TestNG

Issue running TestNG from Jenkins

尝试通过 Jenkins 触发 Selenium 测试时,我遇到了以下问题:

Error: Could not find or load main class org.testng.TestNG
Build step 'Execute shell' marked build as failure
Finished: FAILURE

我的类路径中确实有 testNG jar 文件,如下所示:

我的执行 Shell 命令如下所示:

set classpath="${WORKSPACE}/bin;${WORKSPACE}/lib/*"
chmod a+x ${WORKSPACE}/lib/*.jar
java -cp "${WORKSPACE}/out/production/Test;${WORKSPACE}/lib/*" org.testng.TestNG ${WORKSPACE}/TestNG.xml

这个项目是从 Bitbucket 触发的,是在 IntelliJ 上本地构建的。

如有任何帮助,我们将不胜感激。

您似乎正试图 运行 Linux OS。

在 Linux 上,类路径分隔符是 : 而不是 ;

http://daviditnotes.blogspot.fr/2007/12/java-classpath-separator.html

尝试:

set classpath="${WORKSPACE}/bin:${WORKSPACE}/lib/*"

chmod a+x ${WORKSPACE}/lib/*.jar

java -cp "${WORKSPACE}/out/production/Test:${WORKSPACE}/lib/*" org.testng.TestNG ${WORKSPACE}/TestNG.xml