I have created maven project with cucumber as BDD , integrating it with testng . I have added 2 scenarios in my feature file . I have configured the runner class in my testng.xml and in my runner class I am launching the browser with @BeforeClass . The test successfully runs first scenario but does not run the second one . Please guide how to proceed ahead with this.
My Scenarios in feature file is :
Feature: Base PartyUserStories
Scenario: Verify login
Given the username and password
When login is clicked
Then you enter the login page
Scenario: Verify login and blah blah
Given the username and password
When login is clicked
Then you enter the login page
My Runner class is where I am calling the browser :
@CucumberOptions(features = { "src/test/resources" }, glue = { "com.cucumber.testng.party.tests" })
public class TestRunner extends AbstractTestNGCucumberTests {
public static WebDriver driver;
@BeforeTest
public void run() {
System.out.println("Runs always ");
}
@BeforeMethod(alwaysRun = true)
public void geturl() {
driver = new FirefoxDriver();
driver.get("https:test.aspx");
}
@AfterMethod(alwaysRun = true)
public void quiturl() {
driver.quit();
}
@AfterTest
public void stoprun() {
System.out.println("Runs after every test");
}
}
This is my testng.xml :
<?xml version="1.0"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Party" parallel="none">
<test name="Base Party Validation">
<classes>
<class name="com.cucumber.testng.runner.TestRunner"/>
</classes>
</test>
</suite>
It runs the first scenario successfully , for second scenario it doesn't launch the browser . Please help me with this .