Sunday, 15 February 2015

TASK 3

       Consider the below example program, below program explain the usage of TEST NG annotation. In the above program I have shown the outline of the program.

     Where ever I wrote System.out.println(""); comes the actual Selenium code. You can write the Selenium code for testing. The class after @Test act as the test case. The main advantage of the TEST NG is that report it generate. Its easy understands the performance of the application. It generates the result of the test suit. How many test cases pass how many failed. It gives a good HTML view

import org.testng.annotations.AfterMethod;

import org.testng.annotations.AfterTest;

import org.testng.annotations.BeforeMethod;

import org.testng.annotations.BeforeTest;

import org.testng.annotations.Test;

public class W3Schools
{

   @BeforeTest

   public void  Open_DB_Connectio()
      {

    System.out.println("Database Connection Opened...");
 }

   @AfterTest

   public void Close__DB_Connection()
      {

    System.out.println("Database Connection Closed...");
 }

   @BeforeMethod

   public void Open_Browser()
      {

    System.out.println("Browser Opened...");
 }

   @AfterMethod

   public void Close_Browser()
      {

    System.out.println("Browser Closed...");
 }

   @Test

   public void Launch()
      {

    System.out.println("Executing...");
 }

   @Test

   public void Learn_HTML_link()
      {
         System.out.println("Learn Link Testing is Executing...");
      }
}

     The key features of TestNG are the XSLT report. XSLT stands for XML (Extensible Mark-up Language) Style sheet Language for Transformations. XSLT gives interactive (user friendly) reports with "Pie Chart” but only on TestNG framework. It is better compared to ReportNG and ordinary TestNG reports. It uses the pure XSL for report generation and Saxon as an XSL2.0 implementation. We will study TestNG deeply later.

No comments:

Post a Comment