如何修复“索引10处的预期方案特定部分:类路径:”在Cucumber-Java中运行要素文件时出错

问题描述 投票:1回答:2

我正在尝试运行我的功能文件。在Eclipse中运行黄瓜功能。但我得到错误。

当我试图运行Runner类(使用Cucumber JVM + JUnit)时。它运行良好。注意: - Cucumber-Junit,Cucumber-java Jars版本4.2.3。 JUnit 4.12。

@Smoke
Feature: Google homepage Functionality.

Scenario: Google homepage.
Given I open a browser
When  I navigate to url
Then  Homepage should open
And   Search box should be present
But   No search result.



Runner Class :-
@RunWith(Cucumber.class)
@CucumberOptions(
    features = "./src/test/resources/GoogleSearch.feature",
    glue = "Impl",
    plugin = { "pretty",
               "html:target/cucumber-htmlreport.html", 
               "json:target/cucmber-report.json" },
    tags= {"@Learn"}
    )
public class GoogleRunner {

}


 On Running feature file
 Error :-
 Exception in thread "main" java.lang.IllegalArgumentException: Expected 
 scheme-specific part at index 10: classpath:
 at java.net.URI.create(URI.java:852)
 at 
io.cucumber.core.model.GluePath.parseAssumeClasspathScheme(GluePath.java:54)
 at io.cucumber.core.model.GluePath.parse(GluePath.java:34)
 at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:160)
 at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:107)
 at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:100)
 at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:96)
 at cucumber.runtime.Runtime$Builder.withArgs(Runtime.java:131)
 at cucumber.runtime.Runtime$Builder.withArgs(Runtime.java:127)
 at cucumber.api.cli.Main.run(Main.java:22)
 at cucumber.api.cli.Main.main(Main.java:8)
 Caused by: java.net.URISyntaxException: Expected scheme-specific part at 
 index 10: classpath:
 at java.net.URI$Parser.fail(URI.java:2848)
 at java.net.URI$Parser.failExpecting(URI.java:2854)
 at java.net.URI$Parser.parse(URI.java:3057)
 at java.net.URI.<init>(URI.java:588)
 at java.net.URI.create(URI.java:850)
 ... 10 more

代码在这里:https://github.com/kwishna/Cucumber_1

java selenium cucumber cucumber-java cucumber-junit
2个回答
1
投票

在使用Cucumber Java / Junit 4.2.2后,我也遇到了这个问题。


1
投票

您必须下载Cucumber Java / Junit 4.2.0的版本并检查IDE中管理的Java版本。

© www.soinside.com 2019 - 2024. All rights reserved.