Articles → SELENIUM → Assertions in Selenium

Assertions in Selenium






Purpose





Syntax


Assert.assertEquals(actual, expected);	











Scenario











Convert our application to TestNG application





Click to Enlarge


Write a code for assertion




package com.FirstSeleniumProject;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.Assert;
import org.testng.annotations.Test;

public class MyClass {
    @Test
    public void TestAnnotation() {
        WebDriver driver;
        String service = "IEDriverServer path";
        System.setProperty("webdriver.ie.driver", service);
        driver = new InternetExplorerDriver();
        driver.get("http://gyansangrah.com/");

        Assert.assertEquals(driver.getTitle(), "Gyan Sangrah");
    }
}



Run the application as TestNG application





Click to Enlarge




Click to Enlarge




Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, April 18, 2017

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250