Getting JUnit Integration Setup in JDeveloper
Our JDeveloper/JUnit integration is provided through an optional, additional download so many JDeveloper/BC4J users probably haven't tried it yet. In my recent work to build a best practices BC4J/Struts reimplementation of the Java Pet Store Demo, I found it incredibly useful as I refactored my application several times, each time improving the package structure for learnability.
To get it going, first download the JUnit Extension for Oracle9i JDeveloper from OTN. The installation is a piece of cake:
- Make sure JDeveloper 9.0.3 is not currently running
- cd JDEVHOME/jdev/lib/ext (the directory for extensions)
- jar xvf jdev903_JUnit.zip (extract the downloaded zip file in the "ext" directory
- Restart JDeveloper 9.0.3
Now, in your "New Gallery" that you see when you do File | New... you will have a new "Unit Tests (JUnit)" category under the "General" top-level category. In there, you can automatically generate a "Business Components Test Fixture" and a "Business Components Test Suite". A test fixture is JUnit terminology for a class that encapsulates some kind of setup/shutdown needed for the test. In the BC4J case we generate you the few lines of code to get an instance of an application module, and the release it when the test is done. The test suite includes a driver class that runs all of your test cases, and an example test that checks the existence of each of your view objects. Running the test driver class by default will bring up the GUI JUnit test runner where you can watch your tests pass or fail.
|