qaf 2.1.13中无法解析要素文件中的元数据标签
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了qaf 2.1.13中无法解析要素文件中的元数据标签相关的知识,希望对你有一定的参考价值。
- config.xml中
- 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;
- 特征:
@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
- 脚步:
@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);
- 结果:
@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: 无法解析指定的连接标
plsql developer不能连接oracle,出现12154 无法解析指定的连接标符?
如何在qaf applicaiton.properties中给FirefoxDrive和gecko驱动程序在firefox中执行