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

Why Jmeter is best option for Performance Testing?

There are multiple tools in market for performance testing of any software but Jmeter is the best solution among all of them due to some reason listed below 1) Jmeter is the open source application so users who use this application will not to pay anything. 2) You can use Jmeter for performance of any web application,  Databases and Web Services (REST and SOAP APIs). 3) Jmeter have the user friendly UI component so it is very easy to use. 4) Jmeter can be used to simulate to put maximum number of concurrent users on a server, network or object to test its strength or to analyze overall performance under different load types. 5) Jmeter also use for functional testing for static( JavaScript and HTML) and dynamic( JSP, Servlets and AJAX) resources. 6) Jmeter provides Verity of graphical representations for performance report so it is easy to understand.

How You Can Test Database?

Now we know the Database Testing which you can learn in my last article. In this article we will discuss about the steps that need to following to test any Database. Database Tester should have some basic knowledge regarding SQL Command like DDL (create/drop),  DML (Insert/Delete/Update) and DCL (Grant/Revoke).

Causes of Software Defects

It is practically impossible that developer develop a bug free software and that software we can deliver without Testing. If the complexity of the software increased then there must be bugs that can harm the users who will use that software.