How to generate test-output folder from testng tests?

Tags: , , ,



How to generate the test-output folder for a testNG test?

I am trying to get the default testng report, index.html

Netbeans7/windows7

I made a simple testng test case, ran it in netbeans 7, and here is the result. I see no test-output. I am displaying the project and file structure.

If I need to do something with ant or maven, please describe VERY detailed steps as to how to proceed on Windows 7 — I am new to both of those tools.

If I need to do something with build.xml, please give explicit, detailed steps

netbeans testng output and project file structure

EDIT:

here is a screenshot of my final netbeans layout, including the TestSuite.xml file that got the results folder to generate: enter image description here

Answer

By default the report files (HTML & XML) are written to a folder named test-output under your workspace.

Netbeans however overrides this location. It places output to build/test/results folder. Please re-run the TestNG test suite and watch results folder. All required files will be generated there.

If you want to tinker with the output location open file nbproject/project.properties under your project folder. In that file there is a property called build.test.results.dir which gets passed as an argument to ant task for TestNG run. I do not think you need to edit netbeans generated build files for this purpose.

Also, when you run the tests, have a look at the console(netbeans) output, there it may print messages such as :

[-d output-directory]
default output directory to : test-output


Source: stackoverflow