2017-03-15 157 views
0

運行TestNG的當試圖觸發Selenium測試直通詹金斯,我遇到了以下問題:問題從詹金斯

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

我有(如下所示)在我的類路徑TestNG的jar文件:

My Execute 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上。

任何幫助在這裏,將不勝感激。

回答

3

看起來你試圖在Linux操作系統上運行。

在Linux上,類路徑分隔符是:而不是;

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

嘗試:

設置CLASSPATH = 「$ {WORKSPACE}/bin中:$ {WORKSPACE}/lib目錄/ *」

存取權限chmod a + x $ {WORKSPACE}/。LIB/*罐子

java命令 「$ {WORKSPACE} /出/生產/測試:$ {WORKSPACE}/lib目錄/ *」 org.testng.TestNG $ {WORKSPACE} /TestNG.xml

+0

謝謝!它現在按預期工作:) –