Friday, August 24, 2012

JUNIT4 Test case annotations.


@Before ‘ :
In JUnit4 @Before is used to execute set of preconditions before executing a test. 

@After “ :
Method that is marked with @After gets executed after execution of every test. 

@BeforeClass” :
If a JUnit test case class contains lot of tests which all together need a method which sets up a precondition and that needs to be executed before executing the Test Case class then we can utilize “@BeforeClass” annotation.

@AfterClass” :
In the same way “@AfterClass” annotation can be used to execute a method that needs to be executed after executing all the tests in a JUnit Test Case class.

@Test” :
Write you function call in the test method.

No comments:

Post a Comment