User: Password:
   Keep me logged in.
Register  |  I forgot my password

Login  |  Register

Efficient Java tools  - Article Details

Codign CoView: JUnit Test Generation

Date Added: May 02, 2010 02:36:50 PM
Author:
Category: Testing: Code Coverage

Step 1: Pick Your Class

The first step is simple. From the Package Explorer, pick the class you want to unit test. Right click on the class and select CoView > Create CoView JUnit Test Case.

Step 2: Answer A Few Questions

Notice that a wizard appears.

Answer a few questions and pick the methods you want to test, and CoView does the rest. Wait, you may say, why am I picking methods? Because CoView is different - CoView creates 1 JUnit test case per path in a method. Read more if you want.

Step 3: Define Parameters & Pick Assertions

Notice the test class is created, and you have 1 test case per method path, which is a very effective, maintainable and consistent way to create JUnit tests.

What's next? Well, take a closer look at the test cases. Notice that the decisions for each path are defined in the comments, and that CoView inserts a fail as an assertion. You, the developer, have to modify the assertion and change the test case parameters to match the path.

Ratings
You must be logged in to leave a rating.
Average rating: (0 votes)
Comments

No Comments Yet.


You must be logged in to leave a Comment.