TestNG: Method under annotation @AfterMethod is not getting executed and the test Method, and also @dependsonmethod also not working

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

TestNG: Method under annotation @AfterMethod is not getting executed and the test Method, and also @dependsonmethod also not working

Nithin N Thelkar
public class CWTest 
{
public WebDriver driver;
  @BeforeMethod
  @Parameters("browser")
  public void LaunchBrowser(String browser)
  {
 if(browser.equalsIgnoreCase("firefox"))
 {
 System.setProperty("webdriver.gecko.driver", "E:\\Application Softwares\\geckodriver.exe");
 driver = new FirefoxDriver();
 }
 
 else if (browser.equalsIgnoreCase("chrome"))
 {
 System.setProperty("webdriver.chrome.driver", "E:\\Application Softwares\\chromedriver_win32\\chromedriver.exe");
 driver = new ChromeDriver();
 }
 
 driver.get("example.com");
 
  }
  
  @Test (priority = 0)
  public void Login() throws InterruptedException
  {
   
 /* Login scenario */
 
  }
  
  @Test (priority = 1, dependsOnMethods = { "Login" })
  public void AddUser()
  {
 /* Test scenario */
  }
  
  
  
  @AfterMethod
  public void Logout()
  {
 /* Logout scenario */
  }
  
  
  
}

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Loading...