如何将TestNG测试输出文件夹配置为在Maven目标文件夹中? [英] How to config TestNG test-output folder to be inside Maven target folder?

查看:206
本文介绍了如何将TestNG测试输出文件夹配置为在Maven目标文件夹中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计!

我是TestNG的新手,我正在尝试使用Maven(Surefire插件)和Eclipse.

当我的测试由Maven运行时,其报告将按预期放置在target/surefire-reports上,但是当Eclipse TestNG插件运行相同的测试时,我希望将它们也放置在目标子文件夹中(因此被干净的Maven目标清除,被git忽略,不是说尊重Maven文件夹组织),但始终转到默认的$ {basedir}/test-output.

有一种方法可以做到吗?我希望我不需要手动配置Eclipse设置(TestNG不能检测到它是Maven项目,因此始终更改其输出文件夹吗?),但是如果没有这种方法,那么肯定有人会提供帮助. /p>

TIA和问候

Heleno

解决方案

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.

这篇关于如何将TestNG测试输出文件夹配置为在Maven目标文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆