0

我想运行测试 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:

但我已经在课程步骤定义中定义了它们,任何人都可以帮助我

4

0 回答 0