Cucumber 未找到要素文件的定义
我对硒黄瓜不熟悉。我在要素文件“找不到定义…”上遇到错误。但我已经写下了定义。我也可以很好地执行cumber测试 特色:Cucumber 未找到要素文件的定义,cucumber,Cucumber,我对硒黄瓜不熟悉。我在要素文件“找不到定义…”上遇到错误。但我已经写下了定义。我也可以很好地执行cumber测试 特色: Feature: LOGIN_FEATURE Scenario: login scenario Given User is already on login page When title is crom Then user enters un and pw 步骤定义: package stepDefinition; import io.cucumber.jav
Feature: LOGIN_FEATURE
Scenario: login scenario
Given User is already on login page
When title is crom
Then user enters un and pw
步骤定义:
package stepDefinition;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import junit.framework.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import static org.junit.Assert.*;
//import org.junit.Assert;
import static org.testng.Assert.assertTrue;
//import cucumber.api.java.en.Given;
public class loginStepDef {
WebDriver driver;
//@Then"^login should be unsuccessful$"
@Given ("^User is already on login page$")
public void User_already_on_login_page(){
System.out.println("givenM method started");
System.setProperty("webdriver.chrome.driver","C:\\src\\main\\resources\\chromedriver.exe");
driver = new ChromeDriver();
driver.get("https://web.bettylist.com/user");
System.out.println("---Navigated to the URL.");
}
//@SuppressWarnings("deprecation")
@When("^title is crom$")
public void title_is_crom(){
System.out.println("whenM started.");
String title = driver.getTitle();
System.out.println("title" + title);
//Assert.assertEquals("Ff", title);
assertEquals("Log in | bettylist", title);
System.out.println("---validated the title before logging in.");
}
跑步者:
package MyRunner;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
//import cucumber.junit.Cucumber;
//import cucumber.api.CucumberOptions;
//import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
features = "workspace/Cucumber3/src/main/java/Features",
glue="stepDefinition"
//format = {"pretty", "html:target/Destination"}
//plugin = {"pretty","html:test-outout"},
//plugin = {"json:Folder_Name1/cucumber.json"},
//plugin = {"junit:Folder_Name/cucumber.xml"},
//dryRun = false
//monochrome = false,
//strict = false
)
public class TestRunner {
}
我正在使用ecliipse IDE。我还安装了自然插件。如何修复在要素文件中找不到定义的问题?要素路径相对于项目的根目录。因此,
src/main/java/Features
。我已经更改为Features=“src/main/java/Features”,并且我仍然有相同的警告。然后您可能需要运行整个教程:记住从sratch开始。功能路径相对于项目的根。因此,src/main/java/Features
。我已经更改为Features=“src/main/java/Features”,并且我仍然有相同的警告。然后您可能需要运行教程:记住从sratch开始。