2016-04-04 51 views
0

我正在部署使用蚂蚁的黄瓜测试。 Ant会生成报告,但是这些测试的状态会被跳过,并且场景显示它未定义。 我想知道这是我的亚军班的问题吗?黄瓜测试没有运行使用蚂蚁?

我的代码:

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 { 

} 

我的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

快速浏览一下你亚军类不告诉我,这是坏了。

但是,我会减少这个问题,并从一些有效的工作开始。在这种情况下,我会克隆https://github.com/cucumber/cucumber-java-skeleton或将其下载为zip并查看它是否有效。然后我会介绍你一步一步的东西。非常小的步骤,并始终验证场景是否正确执行。

你有一些问题,至少在我看来,你有很多事情在你的构建中进行。

还记得加尔定律: “工作的复杂系统总是从一个简单的系统发展而来,一个复杂的系统从头开始设计,永远不会工作,不能修补以使其工作。完成一个简单的系统。“

0

我认为你必须扩展类似于此

public class TestRunner extends AbstractTestNGCucumberTests { 
抽象测试类