Monday Jul 27, 2015

Modifying the run configuration for the JUnit test runner

Sometimes it is necessary to set specific java properties or to add specific virtual machine options when unit tests are executed with JDeveloper's JUnit test runner. However, there is no separate option to modify the runtime environment for the test runner - it simply takes the active run configuration which is selected in the "Run/Choose Active Run Configuration" menu (which is by the way the case for any "Run..." and "Debug..." actions executed from context menus, e.g. on a ViewController project).

Adding a test execution specific run configuration (e.g. to add properties to enable logging) is therefore not different from adding a new run configuration for an application:

Select "Run/Choose Active Run Configuration/Manage Run configurations" and press "New" to create a new run configuration:

JDeveloper allows to copy an existing run configuration (e.g. "Default") as the basis. Press "Ok" to save the new configuration, then, press "Edit" to open the Run Configuration Editor:

Add some java properties, like -D to define a property or -X to define memory settings. Then press "Ok". Also press "Ok" on the "Project properties" dialog to close it.

The new run configuration is now available in the "Run/Choose Active Run Configuration" menu. To run the JUnit tests with this configuration, simply set it as active and launch the JUnit test.

Remember that this is now the active run configuration for all Run/Debug actions - you might want to reset it to "Default" or something else before launching your application the next time.
About

Andreas
Andreas is an Applications Architect in the Oracle Fusion Applications group.
The intention of this blog is to explore, explain and elaborate Oracle ADF and Java related topics.

Search

Top Tags
Archives
July 2015
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
28
29
30
31
 
       
Today