I am completely new to the WebDriver and TestNG environments. I started with a project that performs a regression test of an e-commerce website. I ended up registering and registering and so on. But there is something that I do not quite understand.
For example, I have this simple code that is looking for a product.
driver.get(url + "/k/k.aspx"); driver.findElement(By.id("q")).clear(); driver.findElement(By.id("q")).sendKeys("xxxx"); //TODO: Make this dynamic driver.findElement(By.cssSelector("input.submit")).click();
Now I want to check if xxxx is present on the page. This can be done using
webdriver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*xxxxxx[\\s\\S]*$")
I store this in a boolean and check if its true or false.
Now for the question based on this Boolean value, I want to say that the test result is successful or unsuccessful. How can i do this? What causes testNG test?
source share