TESTNG Installation and display report

0
1) Open eclipse -----> Help----> Eclipse Marketplace.
1.1) A new window would open up, wherein you need to type “TestNG” in the Find text box and click on the Go button.
1.2) You will now see the search results with TestNG for Eclipse at the top. All you need to do now is click on the Install button next to it.
1.3) Select the “Keep my installation the same” option and again click on the Confirm button.
After successfully installing res-start eclipse.
2) Create New JAVA Project -----> Build Path---> Add Selenium JAR File-
3)  Build Path---> Add Library
4) Create a Package and Create TestNG Class
5)  Right Click on TestNG Class and Run by TestNG
6)  Refresh the Project folder to right-click on the project and choose the refresh option.
7)  it will create test-output and open index.html to right-click on the file and show the report
if TestNG is not installed then you can follow another installation step to visit this site.
https://www.lambdatest.com/blog/how-to-install-testng-in-eclipse-step-by-step-guide/
package scs;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterTest;
public class Example1 {
 WebDriver driver;
 String s;
  @Test
  public void checkTitleEroomRent() {
  driver.get("https://eroomrent.in");
   s = driver.getTitle();
   System.out.println(s);
   if(s!="")
{
System.out.println("Eroom Rent Title is set");
}
else
{
System.out.println("Eroom Rent Title is not set");
}
  }
  @Test
  public void f() {
  driver.get("https://shivatutorials.com");
   s = driver.getTitle();
   System.out.println(s);
   if(s!="")
{
System.out.println("Shiva Tutorials Title is set");
}
else
{
System.out.println("Shiva Tutorials  Title is not set");
}
  }
  @Test
  public void checkTitle() {
  driver.get("https://shivaconceptdigital.com");
   s = driver.getTitle();
   System.out.println(s);
   if(s!="")
{
System.out.println("SCD Tutorials Title is set");
}
else
{
System.out.println("SCD Tutorials  Title is not set");
}
  }
  @BeforeTest
  public void beforeTest() {
    System.setProperty("webdriver.chrome.driver","c://chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
  }
  @AfterTest
  public void afterTest() {
driver.close();
  }
}


Post a Comment

0Comments

POST Answer of Questions and ASK to Doubt

Post a Comment (0)