JUnit Framework
Components:
@ Test--->Actual Test
@ BeforeEach--->Execute before each test
@ AfterEach--->Execute after each test
@ beforeAll-->like before suite runs before everything
@ AfterAll--->runs after all
@ Disabled---usedto skip particular test
@ Display NAme--->to enhacne vissibleity of method
@ Tag (used to group the methods)
@ BeforeClass=---->Runs before all tests in one class,this must be static--->depreceate in junit 5 with beforeAll
@ AfterClass-->Runs after all tests in one class,this must be static--->Deprecated in junit 5with afterAll
Runner:
@ RunWith(Suite.class)
@ Suite.SuiteClasses({testclass.class,test2.class”})
public class suite{
}
@ Parameterised:
@ParameterisedTest
@ValueSoruce(strings={"sangar","Sangar"})
void test(String sun){
}Testng | Junit |
|---|---|
has more annotations like @ BeforeMethod,beforeclass,beforesuite,aftersuite,aftermehotd,afterclass | has only few annotations like BeforeAll,BeforeEAch,aftereach,afterall |
enabled=false | @ Disabled |
@ Groups(“@smoke”) | @ Tag |
Parallel execution can be achieved | not achievable |
dependency management like dependson methods | no |
data driven is more powerfull which is data provider | using Parameterised set |
testng.xml file | no such file |
listerner cllass | no listener |
Comments
Post a Comment