Need help, my question here is how can I code it such when the result is not expected testNG will display the test case as failure/fail? if the result is expected test case result is passed? very new to TestNG. my problem here is no matter how many times I run, the testNG result is PASSED.
public class TestNgbasic{ DesktopOptions option=new DesktopOptions();
@BeforeMethod
public void setup() {
// DesktopOptions option=new DesktopOptions(); // Start your outlook session
option.setApplicationPath("C:\\Windows\\System32\\calc.exe");
}
@Test
public void testcase1 () throws MalformedURLException, InterruptedException
{
WiniumDriver driver=new WiniumDriver(new URL("http://localhost:9999"), option);
Thread.sleep(5000);
driver.findElement(By.name("Seven")).click();
driver.findElement(By.id("plusButton")).click();
driver.findElement(By.name("Eight")).click();
driver.findElement(By.id("equalButton")).click();
Thread.sleep(5000);
String result = driver.findElement(By.id("CalculatorResults")).getAttribute("Name");
if ("Display is 15".equals(result))
{
System.out.print("Pass");
}
else
System.out.print("Fail");
}
}
Assert.assertEquals(actualtitle, expectedtitle);
fails the test . You have to importimport org.testng.Assert;