TestNG未在测试套件中运行测试 [英] TestNG not running tests in testing suite
问题描述
我正在尝试使用XML和TestNG运行测试套件,但是我总是同时使用Eclipse和命令行得到相同的消息:
I'm trying to run a testing suite using XML and TestNG, but I'm always getting the same message using both: Eclipse and the command line:
[TestNG] Running:
/Users/achavez/Programs/Selenium/java/src/tests/resources/testng.xml
===============================================
TestingSuite1
Total tests run: 0, Failures: 0, Skips: 0
===============================================
文件已正确读取,但似乎测试未运行。
The file is read correctly, but it seems like the tests are not running.
这些是我的testng.xml的内容:
These are the contents of my testng.xml:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="TestingSuite1" verbose="1">
<test name="Test1" >
<packages>
<package name="tests"/>
</packages>
</test>
</suite>
这是我的目录结构在Eclipse中的样子:
and this is how my directory structure looks like in Eclipse:
此外,这也是我尝试通过命令行运行测试套件的方式:
Also, this is also how I'm attempting to run the testing suite through the command line:
java -jar /Applications/Zend\ Studio.app/Contents/Resources/Java/plugins/org.testng.eclipse_6.8.6.20141201_2240/lib/testng.jar src/tests/resources/testng.xml
我试图通过eclipse清理项目,但这似乎没有帮助。我还尝试运行:
I've tried cleaning the project through eclipse, and that didn't seem to help. I also tried running:
mvn clean
,但是它也没有完成任务。
mvn clean
but it didn't do the job either.
任何帮助我指出正确方向的帮助都会受到赞赏!
Any help pointing me to the right direction will be greatly appreciated!
推荐答案
您也可以检查导入的导入Test批注,应为:
You could also check imports for imported Test annotation, should be:
import org.testng.annotations.Test;
@Test
public myTest(){ ... }
而不是例如:
import org.junit.Test;
这篇关于TestNG未在测试套件中运行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!