import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
public class Sample {
public String baseUrl = "https://www.facebook.com/";
public WebDriver driver = new FirefoxDriver();
@BeforeTest
public void beforeTest()
{
driver.get(baseUrl);
}
@Test
public void test1()
{
driver.get(baseUrl);
String expectedTitle = "Facebook - Log In or Sign Up";
String actualTitle = driver.getTitle();
Assert.assertEquals(actualTitle, expectedTitle);
}
@Test
public void test2()
{
driver.get(baseUrl);
String expectedTitle = "Facebook - Log In or Sign Up";
String actualTitle = driver.getTitle();
Assert.assertEquals(actualTitle, expectedTitle);
}
@AfterTest
public void afterTest()
{
driver.close();
}
}--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c3cf2397-ec3d-4d74-837d-cec16d345676%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
"@AfterTest" will execute after each '@test' execution.u can make"@AfterTest" as '@AfterSuite'
On Mon, Apr 4, 2016 at 1:17 PM, Rahil Kumar <info....@gmail.com> wrote:
--
"@AfterTest" will execute after each '@test' execution.u can make "@AfterTest" as '@AfterSuite' --
hi , I have replaced AfterTest and BeforeTest with AfterMethod and beforemethod respectively , In in this case only test1 () Passed , other test2() and aftertest() failed
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CACKfbcBjqZyrRzGiuRJxBfo5yrpMUqrLBSqDzJ3vzBr18KCD9Q%40mail.gmail.com.