Thursday, March 31, 2022

Selenium TestNG PART - 1

 TestNG :

  •      TestNG is an open-source testing framework where NG stands for 'Next Generation.
  •      Failed test cases can be run separately using TestNG.
  •      Test Reports can be generated using TestNG.

Program :

 package selenium;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.testng.Assert;

import org.testng.annotations.Test;


public class NewTestNG {

public String baseUrl = "https://suriyaparithy.blogspot.com/";

String driverPath = "C:\\Selenium\\chromedriver\\chromedriver.exe";

public WebDriver driver ;

  @Test

  public void homepage() {

  System.out.println("launching chrome browser");

  System.setProperty("webdriver.chrome.driver","C:\\Selenium\\chromedriver\\chromedriver.exe");

  WebDriver driver = new ChromeDriver();

  driver.manage().window().maximize();

  driver.get(baseUrl);

  String expectedTitle = "Learning Oracle Application and Software Testing";

  String actualTitle = driver.getTitle();

  Assert.assertEquals(actualTitle, expectedTitle);

  }

}


No comments:

Post a Comment