Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to config TestNG test-output folder to be inside Maven target folder?

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

like image 641
helenov Avatar asked Apr 10 '14 18:04

helenov


People also ask

How do I create a TestNG output folder?

TestNG supports default report generation when a user runs testng. xml, either from an IDE or the command line. By default, all reports are generated at the Project -> test-output folder. If the test-output folder is not present, then TestNG creates it at runtime and saves all the files related to the result.

Can we use TestNG with Maven?

Running TestNG and JUnit Tests1 and higher provides support to run TestNG and JUnit 4. x in current Maven project. All you need is to introduce TestNG and JUnit dependency in POM.

How do I enable TestNG report in Intellij?

Run a test suite To be able to run a TestNG test suite, create a run configuration for this suite: From the main menu, select Run | Edit Configurations. and from the list that opens, select TestNG.


1 Answers

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.

like image 72
niharika_neo Avatar answered Sep 21 '22 12:09

niharika_neo