gpt4 book ai didi

Cucumber Runner class & running tags from any Main Java Program(Cucumber Runner类&来自任何Java主程序的运行标记)

转载 作者:bug小助手 更新时间:2023-10-25 14:48:26 26 4
gpt4 key购买 nike



I want to run the tags by calling the Cucumber class which is as below. How this can be achieved?

我想通过调用Cucumber类来运行标记,如下所示。如何才能做到这一点?


public class SuiteRunner extends AbstractTestNGCucumberTests {

private TestNGCucumberRunner testNGCucumberRunner;

@BeforeClass(alwaysRun = true)
public void setUpClass() throws Exception {
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
}

@Test(dataProvider = "features")
public void feature(PickleEventWrapper eventwrapper, CucumberFeatureWrapper cucumberFeature) throws Throwable {
testNGCucumberRunner.runScenario(eventwrapper.getPickleEvent());
}

@DataProvider
public Object[][] features() {
return testNGCucumberRunner.provideScenarios();
}

@AfterClass(alwaysRun = true)
public void tearDownClass() throws Exception {
testNGCucumberRunner.finish();
}

}

Tried to achieve this using the below code. But it giving me compilation error for CustomClass loader.

尝试使用下面的代码来实现这一点。但是它给了我CustomClass加载器的编译错误。


ClassLoader classLoader = CustomClass.class.getClassLoader();
ResourceLoader resourceLoader = new MultiLoader(classLoader);
ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);

/* Adding cucumber plugins */
List<String> pluginList = new ArrayList<String>();
pluginList.add("--plugin");
pluginList.add("html:target/cucumber-html-report");
pluginList.add("--plugin");
pluginList.add("json:target/cucumber.json");
pluginList.add("--plugin");
pluginList.add("com.cucumber.listener.ExtentCucumberFormatter:");
pluginList.add("--plugin");
pluginList.add("rerun:target/failedScenarios.txt");

更多回答
优秀答案推荐
更多回答

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com