Talk:UnitTests
I can create a test (I am using the TestNG plugin), but it seems that the XML files need to be edited by hand (because they are not being populated) and there is not documentation I can find to do that.
Can someone that has gotten TestNG or even JUnit provide info on how to do this?
Here is the output from running a test:
Property "j2ee.platform.classpath" has not been set [TestNGAntTask] TESTNG PASSED @C:\DOCUME~1\mriley\LOCALS~1\Temp\testng1797384250073651143 WHICH CONTAINS:
-log 2 -usedefaultlisteners true -d H:\NetBeansProjects\SimpleGridTestNG\build\test\results -suitename Ant suite -testname Ant test
dropping H:\NetBeansProjects\SimpleGridTestNG\${j2ee.platform.classpath} from path as it doesn't exist dropping H:\NetBeansProjects\SimpleGridTestNG\${j2ee.platform.classpath} from path as it doesn't exist dropping H:\NetBeansProjects\SimpleGridTestNG\${j2ee.platform.classpath} from path as it doesn't exist dropping H:\NetBeansProjects\SimpleGridTestNG\${j2ee.platform.classpath} from path as it doesn't exist Executing 'C:\Program Files\Java\jdk1.6.0_26\jre\bin\java.exe' with arguments: '-ea' '-classpath' 'H:\NetBeansProjects\libJava\dist\libJava.jar;H:\NetBeansProjects\DOTN_Helper\dist\DOTN_Helper.jar;C:\Documents and Settings\mriley\.netbeans\7.0\modules\ext\testng\testng-6.0.1.jar;C:\Selenium\selenium-2.0.0\selenium-java-2.0.0.jar;C:\Selenium\selenium-2.0.0\libs\apache-mime4j-0.6.jar;C:\Selenium\selenium-2.0.0\libs\bsh-1.3.0.jar;C:\Selenium\selenium-2.0.0\libs\cglib-nodep-2.1_3.jar;C:\Selenium\selenium-2.0.0\libs\commons-codec-1.4.jar;C:\Selenium\selenium-2.0.0\libs\commons-collections-3.2.1.jar;C:\Selenium\selenium-2.0.0\libs\commons-io-2.0.1.jar;C:\Selenium\selenium-2.0.0\libs\commons-jxpath-1.3.jar;C:\Selenium\selenium-2.0.0\libs\commons-lang-2.4.jar;C:\Selenium\selenium-2.0.0\libs\commons-logging-1.1.1.jar;C:\Selenium\selenium-2.0.0\libs\cssparser-0.9.5.jar;C:\Selenium\selenium-2.0.0\libs\guava-r09.jar;C:\Selenium\selenium-2.0.0\libs\hamcrest-all-1.1.jar;C:\Selenium\selenium-2.0.0\libs\htmlunit-2.8.jar;C:\Selenium\selenium-2.0.0\libs\htmlunit-core-js-2.8.jar;C:\Selenium\selenium-2.0.0\libs\httpclient-4.0.2.jar;C:\Selenium\selenium-2.0.0\libs\httpcore-4.0.1.jar;C:\Selenium\selenium-2.0.0\libs\httpmime-4.0.1.jar;C:\Selenium\selenium-2.0.0\libs\jcommander-1.13.jar;C:\Selenium\selenium-2.0.0\libs\jna-3.3.0.jar;C:\Selenium\selenium-2.0.0\libs\json-20080701.jar;C:\Selenium\selenium-2.0.0\libs\junit-dep-4.8.1.jar;C:\Selenium\selenium-2.0.0\libs\nekohtml-1.9.14.jar;C:\Selenium\selenium-2.0.0\libs\protobuf-java-2.3.0.jar;C:\Selenium\selenium-2.0.0\libs\sac-1.3.jar;C:\Selenium\selenium-2.0.0\libs\serializer-2.7.1.jar;C:\Selenium\selenium-2.0.0\libs\testng-6.0.1-nobsh-noguice.jar;C:\Selenium\selenium-2.0.0\libs\webdriver-opera-v0.5.2.jar;C:\Selenium\selenium-2.0.0\libs\xalan-2.7.1.jar;C:\Selenium\selenium-2.0.0\libs\xercesImpl-2.9.1.jar;C:\Selenium\selenium-2.0.0\libs\xml-apis-1.3.04.jar;H:\NetBeansProjects\SimpleGridTestNG\build\classes;H:\NetBeansProjects\SimpleGridTestNG\build\test\classes' 'org.testng.TestNG' '@C:\DOCUME~1\mriley\LOCALS~1\Temp\testng1797384250073651143'
The ' characters around the executable and arguments are not part of the command. Usage: <main class> [options]
The XML suite files to run
Options:
-configfailurepolicy Configuration failure policy (skip or
continue)
-d Output directory
-dataproviderthreadcount Number of threads to use when running
data providers
-excludegroups Comma-separated list of group names to
You need to specify at least one testng.xml, one class or one method You need to specify at least one testng.xml, one class or one method
exclude
exclude
-groups Comma-separated list of group names to be
run
-junit JUnit mode
Default: false
-listener List of .class files or list of class
names implementing ITestListener or
ISuiteListener
-methods Comma separated of test methods
Default: []
-methodselectors List of .class files or list of class
names implementing IMethodSelector
-objectfactory List of .class files or list of class
names implementing ITestRunnerFactory
-parallel Parallel mode (methods, tests or classes)
-port The port
-reporter Extended configuration for custom report
listener
-suitename Default name of test suite, if not
specified in suite definition file or
source code
-suitethreadpoolsize Size of the thread pool to use to run
suites
Default: 1
-testclass The list of test classes
-testjar A jar file containing the tests
-testname Default name of test, if not specified in
suitedefinition file or source code
-testnames The list of test names to run
-testrunfactory, -testRunFactory The factory used to create tests
-threadcount Number of threads to use when running
tests in parallel
-usedefaultlisteners Whether to use the default listeners
Default: true
-log, -verbose Level of verbosity
The tests failed.
================ 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.
