In every project it is required to do proper testing, such that every requirement is met. There are many type of testings done in projects like Unit testing, Regression testing, Alpha testing etc.. From developer perspective unit testing should be done properly. In java , j2ee projects we normally use JUNIT framework. There are other frameworks also to do testing.
In ADF application also we will use JUNIT to do unit testing. To use JUNIT we need JUNIT extension for JDeveloper. For testing BC4J components we need BC4J - Junit extension for JDeveloper.
In the following application we have created one ADF model project using HR schema's Employee Table.
We have created entities, views as well as AM (named HRDemoAppModule).
First I have selected Business Components Test Suite to generate all the test fixture, test cases and test suite.
To create the suite I have selected the configuration HRDemoAppModule
.
It will create all the test cases. Now if we run the test suite we will see that all the tests were successful. Now I want to create my own test method . I want to test the data volume is correct or not.
Now as Oracle Database has 107 records. So I have added assertEquals. Do not forget to add @Test before the method under test.
The test succeeded.
In this way we can do unit testing of BC4J components such that code is bug free one.
Please comment..
Good article.
ReplyDeleteAny Idea, why do we need xml file. It shows testMethod etc. We can event put multiple test-cases inside a test-method. How to use this xml file in java code.
Thanks
Sanjeev
Can these tests be run out of the container or is a deployment required ?
ReplyDeleteWhen running the Unit Tests from the generated xxxViewVOTest classes, the integrated WebLogic server is started. Could you please check if you have the same behavior on you machine ?
ReplyDelete