繁体   English   中英

从应用程序按钮运行黄瓜测试文件

[英]Running cucumber test file from application button

我已经在src / main / java中设置了一个包含A类的黄瓜注释的测试文件,并在src / test / java中使用了对B类以下注释的扩展了A类的测试文件:

        @ContextConfiguration(locations = {"classpath:META-INF/application-config.xml", "classpath:META-INF/overrule.xml" })

当我进行Maven全新安装时,这工作正常。 我想要实现的是能够通过A类的黄瓜设置运行功能文件并查看其输出。 到目前为止,我已经设法找到了一种方法,可以让我运行黄瓜测试,但是我似乎无法弄清楚其参数应该是什么。 谁能为我提供一个如何实现功能cumulment.api.cli.Main.run()的示例?

        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                final String[] arguments = {"foo", "bar" };
                cucumber.api.cli.Main.run(arguments, ClassLoader.getSystemClassLoader());
            } catch (final Throwable e) {
                e.printStackTrace();
            }
        }

我将使用cucumber.api.cli.Main.main(args);调用命令行版本cucumber.api.cli.Main.main(args);

其中args是设置了参数的String数组。 我不会使用您引用的run命令。

文档描述了所有可用的选项。

另一个来源可能是Cucumber团队提供的入门项目: https//github.com/cucumber/cucumber-java-skeleton

查看Ant构建脚本https://github.com/cucumber/cucumber-java-skeleton/blob/master/build.xml可能特别感兴趣,以查看它们提供给Cucumber的参数。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM