Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为什么我的.feature文件会说;未定义的步骤参考“;,虽然我的Cumber测试运行良好并检测到了步骤?_Java_Cucumber_Testng_Feature File - Fatal编程技术网

Java 为什么我的.feature文件会说;未定义的步骤参考“;,虽然我的Cumber测试运行良好并检测到了步骤?

Java 为什么我的.feature文件会说;未定义的步骤参考“;,虽然我的Cumber测试运行良好并检测到了步骤?,java,cucumber,testng,feature-file,Java,Cucumber,Testng,Feature File,Intellij是说,当我查看.feature文件时,我的步骤未定义 但是cumber.feature文件运行得很好,它在步骤上绝对匹配 我的TestNG运行程序代码: package package1; import io.cucumber.testng.AbstractTestNGCucumberTests; import io.cucumber.testng.CucumberOptions; import org.testng.annotations.DataProvider; @C

Intellij是说,当我查看.feature文件时,我的步骤未定义

但是cumber.feature文件运行得很好,它在步骤上绝对匹配

我的TestNG运行程序代码:

package package1;

import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import org.testng.annotations.DataProvider;

@CucumberOptions(plugin = "pretty", features = "src/test/resources/package1", glue = "package1")
public class Runner extends AbstractTestNGCucumberTests {

    @Override
    @DataProvider(parallel = true)
    public Object[][] scenarios() {
        return super.scenarios();
    }

}
要素文件中的步骤:

Feature: test feature
  Scenario: test feature scenario
  Given there has been a pebkac
步骤定义文件中的我的步骤:

Given("there has been a pebkac", () -> {
            //driver.findElement(By.id("editTextFieldId")).sendKeys("test");
            autoTools.getElement(new String[]{"editTextFieldId", "IOSIDHERE"}, AutomationTools.IdType.DEFAULT, 15).sendKeys("test");
            System.out.format("test: %n\n");

            //throw new cucumber.api.PendingException();
        });
为什么intellij抱怨它找不到这个步骤?我尝试使用带有注释的步骤定义文件,但遇到了相同的问题

但我注意到,如果我转到功能文件并右键单击->添加步骤,它将使用不推荐的给定方法添加步骤。这让我觉得我可能使用了错误的依赖项,尽管我是从他们网站上的Cumber教程中获得的

我的依赖项:

dependencies {
    testImplementation 'io.cucumber:cucumber-java:4.7.4'

    compile group: 'org.testng', name: 'testng', version: '6.14.3'
    compile group: 'io.cucumber', name: 'cucumber-testng', version: '4.7.4'
    compile group: 'io.appium', name: 'java-client', version: '7.1.0'
}


Intellij已经过时,更新它解决了这个问题


参考资料:

Intellij已过时,更新它解决了此问题

参考: