JUnit is a simple, open source framework to write and run repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks. JUnit features include:
- Assertions for testing expected results
- Test fixtures for sharing common test data
- Test runners for running tests
File -> New -> Choose TestSuite as shown below
- Create a Test class as shown below
- Write the test methods as shown below, Ensure to have @Test annotation.
- Ensure to import below packages
import static org.junit.Assert.*;
import org.junit.Test;
- Open the test suite class, Structure Window -> Right click on class name -> Choose Run/Debug option
- Once you run all the tests, below is the screenshot how it looks like the results.
For More Info, visit : http://junit.sourceforge.net/doc/faq/faq.htm#running_15
- Assertions for testing expected results
- Test fixtures for sharing common test data
- Test runners for running tests
File -> New -> Choose TestSuite as shown below
- Create a Test class as shown below
- Write the test methods as shown below, Ensure to have @Test annotation.
- Ensure to import below packages
import static org.junit.Assert.*;
import org.junit.Test;
- Open the test suite class, Structure Window -> Right click on class name -> Choose Run/Debug option
For More Info, visit : http://junit.sourceforge.net/doc/faq/faq.htm#running_15
No comments:
Post a Comment