<file_sep>package ATTEST;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class ParallelBrowser {
	
	@Test
	@Parameters({"Browser"})
	public void testOne(String browser) throws InterruptedException
	{
	  if(browser.equalsIgnoreCase("ff"))
	  {
		 
		  WebDriver driver=new FirefoxDriver();
		  driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
		  driver.get("https://www.facebook.com/");
		  for(int i =0;i<=10;i++)
		  {
		  System.out.println(driver.getTitle());
			  //System.out.println("Facebook");
		  
		  Thread.sleep(1000);
		  }
		  
	  }
	}
	

	@Test
	@Parameters({"Browser"})
	public void testTwo(String browser) throws InterruptedException
	{
	  if(browser.equalsIgnoreCase("ff"))
	  {
		  WebDriver driver=new FirefoxDriver();
		 driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
		  driver.get("https://www.google.com/");
		  for(int i =0;i<=10;i++)
		  {
		  System.out.println(driver.getTitle());
			  //System.out.println("Google");
		  
		  Thread.sleep(1000);
		  }
		  
		  
	  }
	}
	}


<file_sep>package ATTEST;

import org.testng.Assert;
import org.testng.annotations.Test;



public class Assert1 {
	@Test
	 
	  public void test1() {
		String a = "Rajveer";
		String b = "Singh";
		
		  
		  //System.out.println("test2");
		  Assert.assertTrue(2>11,"Impossible");
		  System.out.println(a+" "+b);
		 
		  
	  }
	@Test (dependsOnMethods = {"test1"})
	  
	  public void test3() {
		
		  System.out.println("test3");
	  }

}
<file_sep><html><head><title>testng.xml for Suite (2)</title></head><body><tt>&lt;?xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"?&gt;
<br/>&lt;!DOCTYPE&nbsp;suite&nbsp;SYSTEM&nbsp;"http://testng.org/testng-1.0.dtd"&gt;
<br/>&lt;suite&nbsp;guice-stage="DEVELOPMENT"&nbsp;name="Suite&nbsp;(2)"&gt;
<br/>&nbsp;&nbsp;&lt;parameter&nbsp;name="First&nbsp;Value"&nbsp;value="Rajveer"/&gt;
<br/>&nbsp;&nbsp;&lt;parameter&nbsp;name="Last&nbsp;Value"&nbsp;value="Singh"/&gt;
<br/>&nbsp;&nbsp;&lt;test&nbsp;name="FirstNameTest"&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;classes&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;class&nbsp;name="ATTEST.Parameterization"&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;methods&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;include&nbsp;name="testOne"/&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/methods&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/class&gt;&nbsp;&lt;!--&nbsp;ATTEST.Parameterization&nbsp;--&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/classes&gt;
<br/>&nbsp;&nbsp;&lt;/test&gt;&nbsp;&lt;!--&nbsp;FirstNameTest&nbsp;--&gt;
<br/>&nbsp;&nbsp;&lt;test&nbsp;name="SecondNameTest"&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameter&nbsp;name="Last&nbsp;Value"&nbsp;value="Vivek"/&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;classes&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;class&nbsp;name="ATTEST.Parameterization"&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;methods&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;include&nbsp;name="testTwo"/&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/methods&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/class&gt;&nbsp;&lt;!--&nbsp;ATTEST.Parameterization&nbsp;--&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/classes&gt;
<br/>&nbsp;&nbsp;&lt;/test&gt;&nbsp;&lt;!--&nbsp;SecondNameTest&nbsp;--&gt;
<br/>&nbsp;&nbsp;&lt;test&nbsp;name="ThirdNameTest"&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameter&nbsp;name="First&nbsp;Value"&nbsp;value="Vivek"/&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameter&nbsp;name="Last&nbsp;Value1"&nbsp;value="P"/&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;classes&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;class&nbsp;name="ATTEST.Parameterization"&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;methods&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;include&nbsp;name="testThree"/&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/methods&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/class&gt;&nbsp;&lt;!--&nbsp;ATTEST.Parameterization&nbsp;--&gt;
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/classes&gt;
<br/>&nbsp;&nbsp;&lt;/test&gt;&nbsp;&lt;!--&nbsp;ThirdNameTest&nbsp;--&gt;
<br/>&lt;/suite&gt;&nbsp;&lt;!--&nbsp;Suite&nbsp;(2)&nbsp;--&gt;
<br/></tt></body></html><file_sep>[SuiteResult context=GRP-Sanity-Group]<file_sep>package ATTEST;

import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;

public class TestNg {
	
	@BeforeClass
	
	public void beforeclass()
	
	{
		
		System.out.println("Initialize Selenium");
	}
	
	@BeforeMethod
	  
	public void openingBrowser() 
	{
		  System.out.println("Opening browser");
	  }
	
	@Test
	 
	  public void test1()
	{
		
		  System.out.println("test1");
		  
		  test t = new test();
		  
	  }
	  
	  @Test
	  
	  public void test2() {
		
		  System.out.println("test2");
	  }
 

  @AfterMethod
 
  public void closeBrowser() 
  
  {
	  System.out.println("Closing Browser");


  }
  
  @AfterClass
	
	public void afterclass()
	
	{
		
		System.out.println("Destroy Selenium");
	}
  
  
}


<file_sep>package ATTEST;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

public class DataProviderClass {
	@Test(dataProvider = "data-provider")
	public void testmethod(String x)
	{
		System.out.println(x);
	}
	
	@DataProvider(name = "data-provider")
	public Object[][] dataProviderMethod()
	{
		return new Object[][]
				{
				
			{"Rajveer"},
			{"Vinit"}
				};
	}

}
<file_sep>package ATTEST;

import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class UseOfBeforeTest {
	@BeforeTest
	public void beforetestmethod1()
	{
	System.out.println("BeforeTestMethod1: Before Test must be executed before execution of any test tag");	
	}
	@Test
	public void testMethod1()
	{
		System.out.println("testMethod 1 is executing");
	}

}
