Professional Documents
Culture Documents
By Arthi Subramanian - Fall 2008: Junit Testing in Jdeveloper
By Arthi Subramanian - Fall 2008: Junit Testing in Jdeveloper
3) In the Step 2, check the available updates for JUnit and click Next.
5) Enter the Oracle user name and password and click OK.
6) The updates will be downloaded and click on Finish. Restart Jdeveloper for the
updates to be installed.
Step 2:
Choose FileNew to open the New Gallery. In the Categories tree, expand General and
select Unit Tests (JUnit). Double click Test Case.
Step 3:
A Create Test Case Wizard appears. In the wizard select the class and corresponding
methods to be tested. Click Next.
Step 4:
Enter the values in the fields name, package and extends fields. The package name in this
case can be different from the one used in the java program. Click Next.
Step 5:
Click Finish. Once this is done the CatalogAppTest.java will be added to the application
navigator.
Step 6:
Thus the test case has been created for the Java program. Open the CatalogAppTest.java
file and include test values to check the functioning of the code.
Step 8:
Right click the test case (named as CatalogAppTest.java in this case) and click on run. A
message box will be displayed asking for the way to start the target. Choose as a Junit
Test Case and click OK.
Step 9:
While the test is run JUnit shows its progress with a progress bar below the input field.
The bar is initially green but turns into red as soon as there is an unsuccessful test. Failed
tests are shown in a list at the bottom. Successful tests are shown with a green bar.
Step 11:
Complete the details in the wizard and click OK.
Step 14:
Enter the name, package details for the test suite and check the generate these message
stubs check box. This will include the public static void main class.
Step 15:
Select the test cases to be inserted and click on Finish. To make the JUnit test classes
accessible to a TestRunner designed to work with earlier versions of JUnit, declare a
static method suite that returns a test as follows:
public static Test suite() {
return new TestSuite(CatalogAppTest.class);}
Step 16:
The suite() method creates a TestSuite instance and adds the test cases to it. Edit this
method if you wish to add or remove test cases.
Include the junit.textui.TestRunner.run()to
public static void main(String args[]) {
junit.textui.TestRunner.run(suite());
}
Step 17:
Now that we've written a test suite containing a collection of test cases and other test
suites, we can run either the test suite or any of its test cases individually. Running a
TestSuite will automatically run all of its subordinate Test Case instances and
TestSuite instances. Select the Test suite from the application navigator and click on
Run.
Step 18:
The Test Suite is successfully executed.
Conclusion:
Thus test cases have been executed in Junit using Jdeveloper.
Dsdskd12234
35635535353
Tests566wqwqwq
pppooopppopopopop
l;llplplplplp
ooioioio