项目结构-图像 结构我正在为我的 java 项目编写一些黄瓜测试。运行黄瓜类时,控制台中没有发生错误,但是根据步骤定义脚本,我已经给出了调用浏览器的脚本,因此根据我的假设,黄瓜类不调用步骤定义类或胶水。您能否检查一下并让我知道为什么不调用它。
Code:
@RunWith(Cucumber.class)
@CucumberOptions(
features={"F:/Selinium/practise-cucumber/practise1/features/login.feature"},
glue={"F:/Selinium/practise-cucumber/practise1/src/Stepdefinition/loginmethod.java"})
public class Runcucumber {
}
Step Definition code:
public class loginmethod {
public WebDriver driver ;
@Given("^User is on Home Page$")
public void user_is_on_home_page() throws Throwable{
System.out.println("homepagre");
System.setProperty("webdriver.chrome.driver",
"F:/Selinium/practise-cucumber/practise1/driver/chromedriver1.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com/");
System.out.println("lUNCHED homepagre");
}
Browser should be invoked