Skip to main content

TestNG Annotations

TestNG support different type of the Annotations. TestNG uses these annotations to execute the Test Cases, Here we are showing the different type of the Annotations.

  • @BeforeSuite will run before  the all test method in this suite will run. It run single time only. 
  • @AfterSuite will run after all test method will run in this suite. It also run single time only.
  • @BeforeTest will be run before any test method belonging to the class inside the <test> tag is run
  • @AfterTest will be run after the all test method belonging to the class inside the <test> tag have run
  • @BeforeGroup: The list of Group that this configuration method will run before. @BeforeGroup will guarantee to run shortly before the First test method that belong to any of these groups is invoked.
  •  @AfterGroup: The list of Group that this configuration method will run after. @AfterGroup will guarantee to run shortly after the First test method that belong to any of these groups is invoked.
  • @BeforeClass will be run before the first test method in the current class is invoked.
  • @AfterClass will be run after all the test method in the current class has been invoked.
  • @BeforeMethod will be run before each test method.
  • @AfterMethod will be run after each test method.
  • @Test: Mark a class or a method as a part of the test 
  • @Parameters: This Annotations describe how to pass the parameters to a @Test Method. 
  • @Listeners: Define listeners on a test class. 
  • @Factory: Mark a method as Factory that returns object that will be used by TestNG as Test Classes. That method must return Object[].
  • @DataProvider: Mark a method as supplying data for a test method. An Annotation method must return object[][] where each object can assigned the parameter list of the test method. The @Test method that want top receive data from this DataProvider needs to use a DataProvider name equals to the name of this annotations.

Comments

Popular posts from this blog

What is API?

In general way, API (Application Programming Interface) is the intermediate software which is useful for two applications to communicate. API is the tool which is used for interaction of two applications. If developer developing any software which have multiple blocks (Modules) than developer use APIs to put them together.

Ad-Hoc Testing

Ad-Hoc Testing is the testing type which is performed without any proper procedure and without any Requirement Specification. Ad-Hoc testing is totally informal testing which have intension to break the application as early as possible and found important defect early.  In Ad-hoc testing tester do not have any test cases so only the users who have very high knowledge regarding the application only they can perform Ad-Hoc Testing.

Smoke Testing

In Smoke Testing, Testing team check the key feature or key bugs of the software. Smoke testing ensure that critical functionality of the software is working fine.If key features are not working then it is no needed to test the overall functionality because it is just waste of time. In Smoke Testing, test team check the basic feature of the software and if basic feature is not working it means software is broken very badly and further testing is unnecessary. If Smoke Testing failed then it is declared that build is unstable and revert back to developer team until smoke test is pass.