黄瓜jvm和apache ant的兼容性

时间:2015-09-24 07:00:44

标签: java ant cucumber-jvm jbehave

我正在探索一个开源项目。截至目前,它使用Jbehave和Ant。但我想用JBchave替换黄瓜JVM的用法。我想知道黄瓜JVM是否与Apache ANT兼容,如果是,我如何在同一个项目中用黄瓜JVM替换JBehave的使用?

1 个答案:

答案 0 :(得分:0)

你可以通过使用JUnit运行器将pseudo-jvm与Ant结合使用。然后像其他JUnit测试一样执行Cucumber-jvm测试。

例如,这是一个简单的JUnit测试,它将在类路径上执行特征文件:

.parent

然后,您可以在package com.example.cuke; import org.junit.runner.RunWith; import cucumber.api.junit.Cucumber; import cucumber.api.CucumberOptions; @RunWith(Cucumber.class) @CucumberOptions(plugin = "json:target/report.json") public class RunCukeTest { }

中使用以下内容编译后执行此测试
build.xml

您需要确保功能文件以及步骤定义位于类路径 <target name="test-cuke"> <junit printsummary="yes" haltonfailure="no"> <classpath refid="test.classpath" /> <test name="com.example.cuke.RunCukeTest" haltonfailure="no" todir="${report.dir}"> <formatter type="plain" /> <formatter type="xml" /> </test> </junit> </target> 上。一旦它们出现,cucumber-jvm将负责其余的工作。