空间是工作空间名称引起java.net.URISyntaxException

时间:2019-02-14 09:38:42

标签: java eclipse selenium cucumber

我正在一个Selenium项目中,我正在使用的工作区名称中有一个空格,因此出现以下错误:

Exception in thread "main" java.lang.IllegalArgumentException: C:/Users/xyz/eclipse-workspace ValveAware/TestProject/src/test/resources/features/Administration/Export.feature is not valid. Try URI[:LINE]*
    at io.cucumber.core.model.FeatureWithLines.parse(FeatureWithLines.java:56)
    at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:189)
    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.lang.IllegalArgumentException: Illegal character in path at index 36: C:/Users/xyz/eclipse-workspace ValveAware/TestProject/src/test/resources/features/Administration/Export.feature
    at java.base/java.net.URI.create(URI.java:883)
    at io.cucumber.core.model.FeaturePath.parseProbableURI(FeaturePath.java:44)
    at io.cucumber.core.model.FeaturePath.parse(FeaturePath.java:37)
    at io.cucumber.core.model.FeatureWithLines.parseFeaturePath(FeatureWithLines.java:77)
    at io.cucumber.core.model.FeatureWithLines.parse(FeatureWithLines.java:53)
    ... 8 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 36: C:/Users/xyz/eclipse-workspace ValveAware/TestProject/src/test/resources/features/Administration/Export.feature
    at java.base/java.net.URI$Parser.fail(URI.java:2915)
    at java.base/java.net.URI$Parser.checkChars(URI.java:3086)
    at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3168)
    at java.base/java.net.URI$Parser.parse(URI.java:3116)
    at java.base/java.net.URI.<init>(URI.java:600)
    at java.base/java.net.URI.create(URI.java:881)
    ... 12 more

我更改了工作空间的名称并删除了空间。我检查了文件Export.feature的路径,并且空间不存在。但是当我执行此文件时,仍然出现相同的错误。

Runner文件:

package valveAware.port.localhost.tests;

import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;

@CucumberOptions(
        features = { "src/test/resources/features/Administration/Export.feature" }, 
        monochrome = true,
        plugin = { "pretty","html:target/Destination" }, 
        glue = { "valveAware.port.localhost.tests" }
        )



public class ValveAwareRunnerTest extends AbstractTestNGCucumberTests{

}

1 个答案:

答案 0 :(得分:0)

我创建了一个新的工作区并导入了项目,然后工作了