Junit is a most famous open source unit testing and regression testing framework in java, which was originally written by Erich Gamma and Kent Beck, it has became an industry standard framework which developers write repeatable tests and do white-box testing.
1). Used for object-oriented technologies and Test Driven Development.
2). Assertions for testing expected results.
3). Test sharing common test data.
4). Able to manage multiple testcase as suite.
5). Provides Graphical and textual testing runner container.
6). Annotation to identify the test methods(After JUnit 4 ).
Test fixture: a class that contains one or more test methods.
Test method: a method that executes a specific test.
Test runner: an application that find describes what must be action have been executed.
Expected Exception: the type of an Exception we expect to be execution of a test method.
Setup: Code that is run before every test method is executed particular user or initializing a singleton.
TearDown: Code that is run after every test method has finish from table that were inserted during the test.
Drive the deign and construction of your code on unit test at a time.
Write a test that the system currently fails.
Quickly write the code to pass the test.
Remove any duplication from the code.
Move on to the next test.