从 Maven 设置 TestNG 的详细级别
当我运行测试时,我讨厌盯着闪烁的光标而不知道正在运行什么。为了解决这个问题,我在所有测试中添加了完成消息。然而我意识到这是一个非常老套的解决方案并且增加了一些绒毛。
假设TestNG的详细级别打印测试描述,我如何在Maven中设置详细级别?请注意,我没有 test.xml 文件,因此如果这是唯一的方法,那么我不知道如何让 test.xml 文件 + Maven 自动生成的 test.xml 文件协同工作。
When I'm running tests I hate staring at a blinking cursor with no idea what's running. To fix this I've added completion messages to all my tests. However I've realized that its a really hacky solution and adds fluff.
Assuming that TestNG's verbosity level prints the test description, how can I set the verbosity level in Maven? Note that I don't have a test.xml file, so if its the only way then I have no idea how to have a test.xml file + Maven's autogenerated test.xml file work together.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Surefire 允许您使用您喜欢的任何命令行参数调用 TestNG,并且 TestNG 确实支持“详细”命令行,因此可能只需执行以下操作即可
Surefire lets you invoke TestNG with any command line parameters you like, and TestNG does support a "verbose" command line, so it's probably only a matter of doing something like
自 maven-failsafe-plugin 版本 2.19 详细级别可以配置如下:
注意:
详细级别为 0 到 10,其中 10 最详细。
-1 会将 TestNG 置于调试模式。
Since maven-failsafe-plugin version 2.19 the verbosity level can be configured as follow:
Note:
The verbosity level is 0 to 10, where 10 is most detailed.
-1 will put TestNG in debug mode.
好吧...所以,你需要让 testng.xml 和 pom.xml 一起工作。
POM.xml
然后,在 testng*.xml 中设置详细级别,
如下所示
Okay... so, you need let testng.xml and pom.xml work togther.
POM.xml
Then, set verbose level in testng*.xml
like that
尝试 verbose level = 10。它不能解决没有 XML 的问题,但它可以为您提供更多您似乎需要的信息。
Try verbose level = 10. It doesn't solve the no XML question, but it can give you more information that you seem to need.