简体   繁体   English

Maven surefire在模块中找不到Testng测试

[英]Maven surefire can't find testng tests in module

Does Maven surefire require a testng.xml file to run testng classes and methods? Maven surefire是否需要testng.xml文件来运行testng类和方法? I have a multi module reactor setup in maven. 我在Maven中有一个多模块反应堆设置。 Testng and some custom tools are located on one module and our tests are located on another module. Testng和一些自定义工具位于一个模块上,而我们的测试位于另一个模块上。 Our structure is like this 我们的结构是这样的

/pom.xml
/testng-utils/pom.xml
/testng-utils/src
/tests/pom.xml
/tests/src

The tests module has a dependency on testng utils. 测试模块依赖于testng utils。 testng-utils module brings in testng and hamcrest. testng-utils模块引入了testng和hamcrest。 Surefire is a plugin in tests/pom.xml. Surefire是tests / pom.xml中的插件。

I use testng annotations inside my tests, and I don't use an testng.xml file, I realize I'm providing very little information so I'm not expecting anything too in depth for an answer, just maybe a hint as to why my tests aren't being found. 我在测试中使用了testng批注,并且没有使用testng.xml文件,我意识到我提供的信息很少,所以我不希望任何深度的答案,而只是暗示为什么找不到我的测试。

Does anyone use a setup at all similar to this, and invoke testng without the use of a testng.xml file through surefire? 是否有人完全使用与此类似的设置,并通过surefire调用testng而不使用testng.xml文件? I can try to include more information if anyone wants it if I'm able, but this is for the company I work for so I can't put much. 如果可以的话,我可以尝试提供更多信息,如果有人愿意的话,但这是给我工作的公司提供的,所以我不能过多地提供信息。

Thanks! 谢谢!

As long as you place your tests under src/test/java directory and follow the *Test.java naming convention surefire should be able to pick them up without any further configuration. 只要将测试放置在src / test / java目录下并遵循* Test.java命名约定,surefire就能在没有任何进一步配置的情况下进行拾取。

Surefire + TestNG Surefire + TestNG

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM