Tuesday 22 January 2013

* Junit Tutorial and Example


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.
Never in the field of software development was so much owed by so many to so few lines of code. – artin Fowler

Junit features

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 ).

Some test concepts in Junit

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.

No comments:

Post a Comment