Follow this procedure to generate an executable test. Before a
test can be run, the test's Java source code must be generated and compiled.
This process is called code generation.
Before the test's Java code can be generated, a location for storing
the code must exist. By convention, this is a folder named src located
in the same Java project as the test. If no source folder named src exists
in any existing Java project, you must create one as explained in
Java Build Path. Once the test's
Java source code is generated, the Eclipse IDE automatically compiles the
source code into an executable test.
To generate a test's source code:
Test Navigator of the
Test Perspective, right-click the test to be run and select Generate Source... or Alt+Shift+T, S. The JUnit Test Definition Code Generation dialog
In the Source Folder field, accept the default
or click Browse to select the source folder in a Java project in which
to store the test code.
In the Package Name field, accept the
default or click Browse to select the package in the selected Java project
in which to store the test code.
In the Class Name field, specify the name of the test code.