【发布时间】:2018-05-09 10:42:58
【问题描述】:
下面给出了 3 个不同的文件详细信息-Feature 文件/运行器文件和 Step Def 文件
@featureTest Feature: Test Facbook smoke Scenario
@Scenario1 Scenario: Test Login with valid Credentials
Given Open chrome and start application
When I enter valid username and valid password
Then User should be login sucessfully
package Runner;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features="Features")
public class testrunner {
}
package stepdef;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class smoketest {
WebDriver driver;
@Given("^Open chrome and start application$")
public void Open_chrome_and_start_application() throws Throwable{
driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com");
}
@When("^I enter valid username and valid password$")
public void I_enter_valid_username_and_valid_password() throws Throwable{
}
@Then("^User should be login sucessfully$")
public void User_should_be_login_sucessfully() throws Throwable{
}
}
【问题讨论】:
-
可以添加异常堆栈跟踪吗?