-
Notifications
You must be signed in to change notification settings - Fork 1
DevRunningTestsPlatformApp
The following article describes some of the ways you can run tests (whether unit or functional) on a NetBeans Platform application.
Unit test is a test on a method not on the overall functionality of a tool or application. Example of unit test if testing of a method than should return always positive integer. Functional test is testing the overall encryption algorithm that uses that method.
-
You can run a single test from the IDE by right-clicking the test’s node within the project explorer and choosing 'Test' from the context menu. If you have the test source file (or the class which corresponds to the test case) open in the editor, you can run it by pressing Ctrl+F6 or its equivalent for your operating system.
-
You can run all tests within a single module by right-clicking the module in the project explorer and choosing 'Test' from the context menu. The default shortcut for this on Windows and most Unix systems is Alt+F6.
-
You can run all tests for the entire application by right-clicking the suite node in the project explorer and choosing 'Test All' from the context menu.
-
You can run a single unit test by by typing
ant test-unit -Dtest.class=com.tomwheeler.example.MyTestClass
in the module’s directory (wherecom.tomwheeler.example.MyTestClass
is the name of the unit test class you want to execute). You can add additional JVM arguments by specifying them in thetest.run.args
system property, but be sure to quote them as appropriate for your operating system. -
You can run a single functional (GUI) test from the command line by typing
ant test-qa-functional -Dtest.class=com.tomwheeler.example.MyTestClass
in the module’s directory. As with unit tests, you can specify additional JVM arguments using thetest.run.args
system property. -
You can run all unit tests for a module by running the
ant test
command from the module’s directory. -
You can run all unit tests for the entire suite by running the
ant test
command from the suite directory.
The NetBeans Platform has inherently supported unit test code coverage (using Cobertura) since version 6.7. To generate a report which measures unit test code coverage for a single module, type ant display-coverage-report
from that module’s directory. Likewise, you can generate a report which measures unit test code coverage for all unit tests in the entire suite by typing ant display-coverage-report
from the suite’s directory. See also Code Coverage.
Debugging tests from using the NetBeans IDE should be pretty straightforward, but if you want to debug a unit test from the command line (i.e. because you want to attach the debugger in a different IDE), then you simply need to run the test from the command line as described above but specify -Dtest.run.args="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
. The test will compile and start to run, but will pause execution until you attach the debugger on port 5005.
The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.
This page was exported from http://wiki.netbeans.org/DevRunningTestsPlatformApp , that was last modified by NetBeans user Skygo on 2013-12-17T22:19:35Z.
NOTE: This document was automatically converted to the AsciiDoc format on 2018-01-26, and needs to be reviewed.
Apache NetBeans is an effort undergoing incubation at The Apache Software Foundation (ASF).
Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects.
While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
This wiki is an experiment pending Apache NetBeans Community approval.