qaf 2.1.13中无法解析要素文件中的元数据标签

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了qaf 2.1.13中无法解析要素文件中的元数据标签相关的知识,希望对你有一定的参考价值。

  1. config.xml中

  1. providerclass: public class CustomDataProdvider @DataProvider(name="my-custom-dp") public static Object[][] dataProviderForBDD() Map<Object, Object> rec1 = Maps.newHashMap(); rec1.put("fruit", "grapes"); rec1.put("color", "green"); Map<Object, Object> rec2 = Maps.newHashMap(); rec2.put("fruit", "banana"); rec2.put("color", "yellow"); return new Object[][] rec1,rec2;
  2. 特征: @TestForTest SCENARIO : Custom Data provider Example META-DATA: "dataProvider":"my-custom-dp", "dataProviderClass":"com.qmetry.qaf.example.CustomDataProvider", "description":"Data driven test that uses custom data provider" Given I am on fruits and colors activity When i select '$fruit' Then the color should be '$color' END
  3. 脚步: @MetaData(value = "'groups':['smoke']") @QAFTestStepProvider public class TestDataProdivider @QAFTestStep(description = "I am on fruits and colors activity") public void test() System.out.println("I am on fruits and colors activity"); @QAFTestStep(description = "i select fruit") public void testfruit(String fruit) System.out.println(fruit); @QAFTestStep(description = "the color should be color") public void testcolor(String color) System.out.println(color);
  4. 结果: @QAFTestStep(description="META-DATA: 0") public void mETADATA(Map<Object,Object> mapObj0) //TODO: remove NotYetImplementedException and call test steps throw new NotYetImplementedException(); 测试被忽略了
答案

您正在使用GherkinScenarioFactory,它希望bdd采用小黄瓜语法。在小黄瓜Meta-data不受支持,但在qaf-bdd支持。你应该使用com.qmetry.qaf.automation.step.client.text.BDDTestFactory。您的bdd文件,比如说suite1.bdd,应该如下所示与BDDTestFactory一起使用。

SCENARIO : Custom Data provider Example
META-DATA: "dataProvider":"my-custom-dp", "dataProviderClass":"com.qmetry.qaf.example.CustomDataProvider", "description":"Data driven test that uses custom data provider","groups":"TestForTest","smoke"
   Given I am on fruits and colors activity
   When i select '$fruit'
   Then the color should be '$color'
END

如果你与原始进行比较,你会发现@TestForTest移动了元数据,使你的场景与qaf-bdd兼容。确保您的bdd文件具有扩展名.bdd以与BDDTestFactory一起使用。

您的配置文件应如下所示:

<suite name="QAF-Demo" verbose="0">
<test name="BDD Tests">
   <parameter name="step.provider.pkg" value="com.qmetry.qaf.example.steps" />
   <parameter name="scenario.file.loc" value="scenarios" />
   <groups>
     <run>
        <include name="TestForTest"/>
     </run>
   </groups>
   <classes>
      <class name="com.qmetry.qaf.automation.step.client.text.BDDTestFactory" />
   </classes>
</test>
</suite>

很少有观察到:

  • 您正试图通过将@MetaData(value = "'groups':['smoke']")放在步骤定义类中来将组添加到步骤中。这没有任何意义。应将组分配给testcase / scenario而不是步骤。
  • 此外,您不需要在步骤定义类中放置@QAFTestStepProvider,因为您使用@QAFTestStep将方法标记为步骤。

所以你的步骤定义类应该如下所示:

public class TestDataProdivider 

   @QAFTestStep(description = "I am on fruits and colors activity")
   public void test()
      System.out.println("I am on fruits and colors activity");
   

   @QAFTestStep(description = "i select fruit")
   public void testfruit(String fruit)
      System.out.println(fruit);
   

   @QAFTestStep(description = "the color should be color")
   public void testcolor(String color)
      System.out.println(color);
   
 

以上是关于qaf 2.1.13中无法解析要素文件中的元数据标签的主要内容,如果未能解决你的问题,请参考以下文章

oracle 中备份数据的时候出现 EXP-00056: 遇到 ORACLE 错误 12154 ORA-12154: TNS: 无法解析指定的连接标

QAF报告未填充在dashboard.htm中

如何在pyspark中解析csv格式的元组数据?

plsql developer不能连接oracle,出现12154 无法解析指定的连接标符?

如何在qaf applicaiton.properties中给FirefoxDrive和gecko驱动程序在firefox中执行

哪位大侠知道:ArcGIS10再打开shp格式文件时为啥会出现"打开要素时出错"和“无法指定数据对象”字样?