没有maven的黄瓜java项目 - 如果我有Runner类,如何从命令提示符运行

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

我有一个跑步者类,里面有我需要运行的标签。选择需要执行的功能时,这一点非常有效

跑步者类看起来像

package test.java.cucumber.policy;

    import com.github.mkolisnyk.cucumber.runner.ExtendedCucumber;
    import com.github.mkolisnyk.cucumber.runner.ExtendedCucumberOptions;
    import cucumber.api.CucumberOptions;
    import cucumber.runtime.ClassFinder;
    import cucumber.runtime.RuntimeOptions;
    import cucumber.runtime.io.MultiLoader;
    import cucumber.runtime.io.ResourceLoader;
    import cucumber.runtime.io.ResourceLoaderClassFinder;
    import gherkin.Main;
    import org.junit.runner.RunWith;

    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;

    @RunWith(ExtendedCucumber.class)


    @ExtendedCucumberOptions(
                    retryCount = 0)

    @CucumberOptions(glue = {"test.java.steps"},
                    features = {"src/test/resources/features/policy/shakedown"},
                  tags = {"@test"}

    )
    public class ShakedownRunner {



    }

当我尝试从命令提示符运行相同时,我得到步骤定义未找到错误消息。

我使用以下命令从命令提示符执行

java -cp "extlib/*;." cucumber.api.cli.Main -p pretty -g C:\21stNov\src\test\java\steps\common\BrowserSteps.java C:\21stNov\src\test\resources\features\policy\shakedown\test.feature

On executing i am getting that the step definitions are missing. Can somebody look into this and provide his valuable comments

#Shakedown Test 1
  @Shakedown @Shakedown1 @rajat
  Scenario: SHD_001_1-Portal SE Quote to GW and check quote documents ←[90m# C:/21stNov/src/test/resources/features/policy/shakedown/test.feature:6←[0m
    ←[33mGiven ←[0m←[33mI start the web browser←[0m

1 Scenarios (←[33m1 undefined←[0m)
1 Steps (←[33m1 undefined←[0m)
0m0.000s


You can implement missing steps with the snippets below:

@Given("^I start the web browser$")
public void i_start_the_web_browser() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

提前致谢..!

cucumber command-line-interface cucumber-java
1个回答
0
投票

这个问题可能与此重复:How to run cucumber file from command line

根据答案,您可以在命令行上使用cucumber-jvm运行它,如下所示:

java -cp <classpath> cucumber.api.cli.Main \
   --glue com.example.test \
   --plugin pretty path/to/features
© www.soinside.com 2019 - 2024. All rights reserved.