Tuesday, September 21, 2021

@BeforeClass,@AfterClass,@Before and @After annotation in Junit ?

 @BeforeClass:  This is annotation is used in that method when there need such situation to do some prior works when test class is loaded in memory. Ex: DB connection establishment.

@Before: This annotation is used when need to do some works before @Test is execute.

@After:    This annotation is used when need to do some works after @Test is execute.

@AfterClass: Is called and execute after all the operation has done in the Test class.

@BeforeClass and @AfterClass runs for once in every test class

No comments:

Post a Comment

Fluent interface pattern

 public class UserConfigurationManager {     private String userName;     private String password;     private UserConfigurationManager() { ...