Академический Документы
Профессиональный Документы
Культура Документы
Junit
Annotation: feature which is added to junit 4, it’s a Meta tab which gives information regarding the
methods placed to next of it.
Annotation Description
@After public void method() Will perform the method after each teat method.
Junit3 Junit4
1 Import junit.framework.* package 1 Import org.junit.* package
2 Need to Extend Junit.framwork.TestCase class 2 Need Not to extend any class.
3 Don’t use annotation for execution order 3 Use annotation to decode execution order .
we need at least 1 @test method to execute the
class
6 Test Method need to follow naming 6 Here we use @test annotation to define our
convention like method name should start with test method
test prefix with no argument and return type
7 Not Available 7 We can ignore a test to participate in
execution just by adding @ignore front or after
@test annotation
8 Not Available 8 We can verify expected annotation using
@Test(expected=ArithmeticException.class)
Advanced Fixture
Both classes use the new annotations @BeforeClass and @AfterClass as well as @Before and
@After. The main differences between these annotations are shown in Table 2.
setUp method( we will find it in selenium test case, it override setup() method of
SeleniumTestCase(inherited to selenium test case) class, it is used for doing configuration
setting before running test case script.(We set before annotation in that to tell junit this method
must be executed before test method.
tearDown() method(we will find it in selenium test case, it override tearDown() method of
SeleniumTestCase(inherited to selenium test case) class, it is used for doing configuration
setting after running test case script.(with after annotation)