I am deploying cucumber tests using ant. Ant generates reports however the status of these tests are skipped and the scenario says it is undefined. I am wondering is it an issue with my runner class?
My code:
package cucumber;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(,
plugin = {"html:target/cucumber-html-report","junit:target/cucumber-junit-report/test.xml"},
features = {"src/cucumber/features"} )
public class CucumberRunner {
}
My build.xml
<!-- Build targets -->
<target name="build" description="Build project" depends="clean,compile,package"/>
<target name="test" description="Test project" depends="build">
<mkdir dir="target/cucumber-junit-report"/>
<java classname="cucumber.api.cli.Main" fork="true" failonerror="false" resultproperty="cucumber.exitstatus">
<classpath refid="test.classpath"/>
<arg value="--format"/>
<!-- creates our junit report -->
<arg value="junit:target/cucumber-junit-report/test.xml"/>
<arg value="--format"/>
<arg value="pretty"/>
<arg value="--format"/>
<!-- creates our cucumber html friendly report -->
<arg value="html:target/cucumber-html-report"/>
<arg value="--format"/>
<!-- creates our cucumber json friendly report -->
<arg value="json:target/cucumber.json"/>
<arg value="--glue"/>
<!-- identifies the package (folder) where the cucumber definitions live -->
<arg value="test.src.cucumber.features"/>
<!-- identifies the folder where the feature files live (looks in all subfolders) -->
<arg value="test/src/cucumber"/>
</java>
<!-- writes out information to junit report -->
<junitreport todir="target/cucumber-junit-report">
<fileset dir="target/cucumber-junit-report">
<include name="test.xml"/>
</fileset>
<report format="frames" todir="target/cucumber-junit-report"/>
</junitreport>
<!-- checks our exit status, and determines success or failure -->
<fail message="Cucumber failed">
<condition>
<not>
<equals arg1="${cucumber.exitstatus}" arg2="0"/>
</not>
</condition>
</fail>
</target>
答案 0 :(得分:0)
快速浏览一下你的跑步者课并没有告诉我它已经坏了。
但是,我会减少问题并从有效的方法开始。在这种情况下,我会克隆https://github.com/cucumber/cucumber-java-skeleton或将其下载为zip并查看它是否有效。然后我会逐步介绍你所拥有的东西。非常小的步骤,并始终验证方案是否正确执行。你有某种问题,至少在我看来,你的构建中有很多事情发生。
记住加尔定律: “一个复杂的系统总是被发现从一个简单的系统发展而来。一个从头开始设计的复杂系统永远不会工作,无法修补以使其工作。你必须重新开始使用一个简单的系统。” / p>
答案 1 :(得分:0)
我认为你必须扩展一个类似于
的抽象测试类public class TestRunner extends AbstractTestNGCucumberTests {