且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将TestNG测试输出文件夹配置为在Maven目标文件夹中?

更新时间:2022-10-23 16:25:25

testng插件无法自动找出答案.

您可以在工作区或项目级别设置测试首选项.如果将其设置在工作台级别,那么对于所有项目,默认情况下,testng会将结果放在此处.

转到窗口->首选项-> TestNG.
将输出目录更改为与maven输出目录相同.

Folks!

I'm new on TestNG, and I'm trying it with Maven (Surefire plugin) and Eclipse.

When my tests are run by Maven its reports are put on target/surefire-reports as expected, but the same tests when run by Eclipse TestNG plugin I'd like them to be put inside a target subfolder also (and as so be cleaned by clean Maven goal and ignored by git, not saying about respecting Maven folder organization), but always go to the default ${basedir}/test-output.

There is a way I can do it? I'd prefer one that I do not need to manually config Eclipse settings (Couldn't TestNG in detect it's a Maven project and so change its output folder consistently?), but if there is no such way, anyone surely will help.

TIA and regards,

Heleno

There is a no way that testng plugin can automatically figure out.

You can set your testng preferences at the workspace or project level. If you set it at the workbench level then for all projects, by default, testng would put the results there.

Go to Window->Prefs->TestNG.
Change Output directory to be same as maven output directory.