lundi 4 avril 2016

Cucumber tests not running using ant?

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>    

Aucun commentaire:

Enregistrer un commentaire