testng

Solutions on MaxInterview for testng by the best coders in the world

showing results for - "testng"
Nele
15 Mar 2019
1TESTNG: TestNextGeneration
2    -> What is TestNG?
3        - TestNG is a UNIT TESTING TOOL.
4        - It was inspired by JUNIT, but a little bit more advanced than JUNIT.
5        - TESTNG helps us create certain testing flow/structure using 
6        its ANNOTATIONS.
7-->  some of the annotation from TestNG are
8    @Test
9    @BeforeSuite
10    @AfterSuite
11    @BeforeTest
12    @AfterTest
13    @BeforeGroups
14    @AfterGroups
15    @BeforeClass
16    @AfterClass
17    @BeforeMethod
18    @AfterMethod
19    
Christian
01 Sep 2016
1TESTNG: TestNextGeneration
2TestNG is a UNIT TESTING TOOL.
3It was inspired by JUNIT, 
4but a little bit more advanced than JUNIT.
5TESTNG helps us create certain testing structure 
6using its ANNOTATIONS.
7@Test @BeforeSuite @AfterSuite@BeforeTest
8@AfterTest @BeforeGroups @AfterGroups
9@BeforeClass @AfterClass @BeforeMethod
10@AfterMethod
11JUnit - the most popular unit testing framework for Java.
12TestNG - was created as improved alternative for JUnit.
13Both of them, targeting unit testing. 
Maria José
31 Jun 2018
1package firsttestngpackage;
2import org.openqa.selenium.*;
3import org.openqa.selenium.firefox.FirefoxDriver;
4import org.testng.Assert;
5import org.testng.annotations.*;
6
7public class firsttestngfile {
8    public String baseUrl = "http://demo.guru99.com/test/newtours/";
9    String driverPath = "C:\\geckodriver.exe";
10    public WebDriver driver ; 
11     
12  @Test
13  public void verifyHomepageTitle() {
14       
15      System.out.println("launching firefox browser"); 
16      System.setProperty("webdriver.gecko.driver", driverPath);
17      driver = new FirefoxDriver();
18      driver.get(baseUrl);
19      String expectedTitle = "Welcome: Mercury Tours";
20      String actualTitle = driver.getTitle();
21      Assert.assertEquals(actualTitle, expectedTitle);
22      driver.close();
23  }
24}
25