我想运行测试JUnit,我在2个不同的项目中工作:
在第一个我有 功能:
Feature: Google Search
Scenario: Validate google search text field
Given open a browser
When navigate to google page
Then validate search text field
步骤定义类:
@Given("^open a browser$")
public void open_a_browser() throws Throwable {
System.setProperty("webdriver.chrome.driver", "D:\\Drive\\chromedriver_win32\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
}
@When("^navigate to google page$")
public void navigate_to_google_page() throws Throwable {
driver.get("http://www.google.com");
}
@Then("^validate search text field$")
public void validate_search_text_field() throws Throwable {
driver.findElement(By.name("q")).sendKeys("selenium "); }
Runner课程:
@RunWith(Cucumber.class)
@CucumberOptions(features={"src\\test\\resources\\com\\tutoriel\\testing\\features\\Googlesearch.feature",
glue={"com\\tutoriel\\testing\\stepdefinitions"})
public class RunTestRunner {
}
它非常适合我
但是当我在另一个大项目中添加这些3步(功能,stepdef和跑步者)时,它不起作用 我不会解决这个问题!!
这是错误
You can implement missing steps with the snippets below:
但我已经在类步骤定义中定义了它们 任何人都可以帮助我