For any Java/J2EE project we wirte lot many java classes. To do the unit test of those Java classes normally we used to write JUnit test cases. Here we have online Junit Tool to generate JUnit test cases for each java class.. Generating Junit testcases common requirement in any Java/J2EE development project.Take Java Code as input and generate JUnit test class as output.
This tool supports following important features:
- Test suites
- Test runners
- JUnit classes
- Supports both JUnitVersion 4.0
and Version 5.0
Gnerated code uses following classes:
- Assert - Contains assert methods.
- TestCase - defines the fixture to run multiple tests.
- TestResult - Collect the results of executing a test case.
How It Works:
First format the java source code and then parse it. Extract the tokens.
Generate JUnit class and add a test method for each non-private methods.
Equate the actual and expeted value. If expected and actual value does
not match, it fail the test cases. It generate code to handle exception
and fail the test case if there is any exception.
. Input Parameters are:
- Java Code - Which is used to generate the JUnit test cases
- Generate Test Cases For Private Methods - Generate unit test
cases for private method
- Click on the button 'Generate JUnit '