I am unable to parse my feature file in cucumber while running i am getting following error, i am creating a BDD test framework to do API testing using cumber feature file concept
io.cucumber.core.gherkin.FeatureParserException:无法解析资源:file:///D:/NodeApiTesting/APITestingNode/src/test/resources/functionalTests/End2End_Test.feature 在io.cucumber.core.gherkin.vintage。 GherkinVintageFeatureParser.parseGherkin5(GherkinVintageFeatureParser.java:40) 在 io.cucumber.core.gherkin.vintage.GherkinVintageFeatureParser.parse(GherkinVintageFeatureParser.java:58) 在 io.cucumber.core.feature.FeatureParser.parseResource(FeatureParser.java:44)在 io.cucumber.core.runtime.FeaturePathFeatureSupplier.lambda$new$0(FeaturePathFeatureSupplier.java:39) 在 java.util.function.BiFunction.lambda$andThen$0(Unknown Source) 在 io.cucumber.core.resource.ResourceScanner。在 io.cucumber.core.resource.PathScanner$ResourceFileVisitor.visitFile(PathScanner.java:67) 在 io.cucumber.core 的 lambda$processResource$2(ResourceScanner.java:126)。resource.PathScanner$ResourceFileVisitor.visitFile(PathScanner.java:52) at java.nio.file.Files.walkFileTree(Unknown Source) at java.nio.file.Files.walkFileTree(Unknown Source) at io.cucumber.core.resource .PathScanner.findResourcesForPath(PathScanner.java:46) at io.cucumber.core.resource.PathScanner.findResourcesForUri(PathScanner.java:26) at io.cucumber.core.resource.ResourceScanner.findResourcesForUri(ResourceScanner.java:109) at io.cucumber.core.resource.ResourceScanner.scanForResourcesUri(ResourceScanner.java:86) 在 io.cucumber.core.runtime.FeaturePathFeatureSupplier.loadFeatures(FeaturePathFeatureSupplier.java:62) 在 io.cucumber.core.runtime.FeaturePathFeatureSupplier.get( FeaturePathFeatureSupplier.java:46) 在 io.cucumber.junit.Cucumber.(Cucumber.java:156) 在 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 在 sun.reflect。NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java: 104) 在 org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86) 在 org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70) 在 org.junit.internal.builders.AllDefaultPossibilitiesBuilder .runnerForClass(AllDefaultPossibilitiesBuilder.java:37) 在 org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70) 在 org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28) 在 org. junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19) 在 org.eclipse.jdt.internal.junit4.runner。JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90) 在 org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76) 在 org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests( JUnit4TestLoader.java:49) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:526) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 770) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210) :io.cucumber.core.gherkin.vintage.internal.gherkin.ParserException$CompositeParserException:解析器错误:(1:1):预期:#EOF,#Language,#TagLine,#FeatureLine,#Comment,#Empty,得到'场景大纲:用户生成授权令牌'(2:2):预期:#EOF、#Language、#TagLine、#FeatureLine、#Comment、#Empty,得到“鉴于我是授权用户”(4:1):预期:# EOF,#Language,#TagLine,#FeatureLine,#Comment,#Empty,得到“场景大纲:授权用户可以添加和删除电话”(5:2):预期:#EOF,#Language,#TagLine,# FeatureLine,#Comment,#Empty,得到“给定电话列表可用”(6:2):预期:#EOF、#Language、#TagLine、#FeatureLine、#Comment、#Empty,得到“当我添加一个电话存储'(7:2):预期:#EOF,#Language,#TagLine,#FeatureLine,#Comment,#Empty,得到'然后电话被添加'(8:2):预期:#EOF,#语言、#TagLine、#FeatureLine、#Comment、#Empty,得到“当我在商店中更新手机时”(9:2):预期:#EOF、#Language、#TagLine、#FeatureLine、#Comment,#Empty,得到“然后手机更新”(10:2):预期:#EOF、#Language、#TagLine、#FeatureLine、#Comment、#Empty,得到“当我从商店中取出手机时'(11:2):预期:#EOF、#Language、#TagLine、#FeatureLine、#Comment、#Empty,得到“然后书被删除”(12:2):预期:#EOF、#Language、# TagLine,#FeatureLine,#Comment,#Empty,在 io.cucumber.core.gherkin.vintage.internal.gherkin.Parser.addError(Parser.java:152) 在 io.cucumber 获得“当我阅读我的手机详细信息时” .core.gherkin.vintage.internal.gherkin.Parser.matchTokenAt_0(Parser.java:491) 在 io.cucumber.core.gherkin.vintage.internal.gherkin.Parser.matchToken(Parser.java:337) 在 io.cucumber .core.gherkin.vintage.internal.gherkin.Parser.parse(Parser.java:137) 在 io.cucumber.core.gherkin.vintage.internal.gherkin.Parser.parse(Parser.java:118) 在 io.cucumber.core.gherkin.vintage.internal.gherkin.Parser.parse(Parser.java:114) 在 io.cucumber.core.gherkin.vintage.GherkinVintageFeatureParser.parseGherkin5(GherkinVintageFeatureParser.java:29) .. . 34 更多
我的功能文件如下
End2End_Test.feature
Scenario Outline: User generates token for Authorisation
Given I am an authorized user
Scenario Outline: the Authorized user can Add and Remove a phone
Given A list of phones are available
When I add a phone to store
Then the phone is added
When I update a phone in my store
Then the phone is updated
When I remove a phone from my store
Then the book is removed
When I am reading my phone details
Then I read my Phone Details
我的 runner.java 文件如下
TestRunner.java
package runners;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/resources/functionalTests",
glue = {"stepDefinitions"},
monochrome = true,
strict = true
)
public class TestRunner {
}