Talk:TestNG

Okay, I have installed both the ANT and Maven versions of the TestNG Plug-Ins in my Netbeans 7.0 IDE. My simple test (created using Selenium) does not appear to have any syntax errors, but when I try and run it I get all sorts of failure messages, starting with one in red that says I either need specify a testng.xml or one class, with no info on how to do that or where to put such an XML file.

I have set some fields for the various Annotations like this, using the syntax suggestions to try and pick logical ones, but need some pointers to better documentation that what is here. This is my first foray into TestNG (or JUnit) testing:

   @Test(alwaysRun = true, description = "DOTN_CUR_VT001",
         suiteName = "Current", testName = "DOTN_CUR_VT001")

Here is what I see when I right click on my test file under Test Packages and choose "Run Test Class" (which would seem to imply I am specifying a class):

init: Deleting: \\fs-home\home\mriley\NetBeansProjects\Current\build\built-jar.properties

deps-jar: Updating property file: \\fs-home\home\mriley\NetBeansProjects\Current\build\built-jar.properties

compile:

compile-test: [TestNGAntTask] TESTNG PASSED @C:\DOCUME~1\mriley\LOCALS~1\Temp\testng384908519274796368 WHICH CONTAINS:

[TestNGAntTask] -log

[TestNGAntTask] 2

[TestNGAntTask] -usedefaultlisteners

[TestNGAntTask] true

[TestNGAntTask] -d

[TestNGAntTask] \\fs-home\home\mriley\NetBeansProjects\Current\build\test\results

[TestNGAntTask] -sourcedir

[TestNGAntTask] \\fs-home\home\mriley\NetBeansProjects\Current\test

[TestNGAntTask] -suitename

[TestNGAntTask] Ant suite

[TestNGAntTask] -testname

[TestNGAntTask] Ant test

You need to specify at least one testng.xml or one class Usage:

[-d output-directory]

default output directory to : test-output

[-testclass list of .class files or list of class names]

[-sourcedir a source directory]

[-annotations javadoc or JDK]

Specifies the default annotation type to be used in suites when none is explicitly specified. This version of TestNG (15) supports both "javadoc" and "JDK" annotation types.

[-groups comma-separated list of group names to be run]

works only with -testclass

[-excludegroups comma-separated list of group names to be excluded]

works only with -testclass

[-testrunfactory list of .class files or list of class names implementing org.testng.ITestRunnerFactory]

[-listener list of .class files or list of class names implementing org.testng.ITestListener and/or org.testng.ISuiteListener]

[-parallel methods|tests] run tests in parallel using the specified mode

[-threadcount number of threads to use when running tests in parallel]

[-suitename name] Default name of test suite, if not specified in suite definition file or source code

[-testname Name] Default name of test, if not specified in suite definition file or source code

[-reporter Extended configuration for custom report listener]

[suite definition files*]


For details, please consult the documentation at http://testng.org.

\\\\fs-home\home\mriley\NetBeansProjects\Current\nbproject\testng-impl.xml:312:

The following error occurred while executing this line:

\\\\fs-home\home\mriley\NetBeansProjects\Current\nbproject\testng-impl.xml:77: an error occured when running TestNG tests

BUILD FAILED (total time: 1 second)

================ Solution found! ==================

You have to add a line like this to the project.properties file for your project:

j2ee.platform.classpath=$(javac.test.classpath)

If your test module names end in Test.java they will now be automatically picked up when you right-click on the project and select 'Test' from the menu.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo