Skip to main content

Posts

Showing posts from October, 2016

ANNOTATIONS FOR JUNIT TESTING

JUnit  Annotations  : The Junit 4.x framework is annotation based, so let's see the annotations that can be used while writing the test cases. @Test annotation specifies that method is the test method. @Test(timeout=1000) annotation specifies that method will be failed if it takes longer than 1000 milliseconds (1 second). @BeforeClass annotation specifies that method will be invoked only once, before starting all the tests. @Before annotation specifies that method will be invoked before each test. @After annotation specifies that method will be invoked after each test. @AfterClass annotation specifies that method will be invoked only once, after finishing all the tests. @Test:             The Test annotation tells JUnit that the public void method to which it is attached can be run as a test case. To run the method, JUnit first constructs a fresh ...