是否可以在AWS设备场上运行QAF BDD测试?

时间:2020-05-07 06:48:35

标签: aws-device-farm qaf

我正在尝试使用AWS设备场执行QAF BDD测试(使用TestNG进行Appium测试),但是不幸的是,即使没有错误,它也不会触发测试用例的执行。在本地执行时同样可以正常工作。

testng.xml配置:

<suite name="QAF Demo" verbose="0">
    <test name="Launch_App" enabled="true">
        <groups>
            <run>
                <include name="SMOKE"/>
            </run>
        </groups>
        <classes>
            <class name="com.qmetry.qaf.automation.step.client.text.BDDTestFactory"/>
        </classes>
    </test>
</suite>

BDD文件:

SCENARIO: SampleTest
META-DATA: {"description":"Sample Test Scenario","groups":["SMOKE"]}

    Given print message

END

AWS的日志:

Start Appium TestNG test
[DeviceFarm] java -Dappium.screenshots.dir=$DEVICEFARM_SCREENSHOT_PATH org.testng.TestNG -testjar *-tests.jar -d $DEVICEFARM_LOG_DIR/test-output -verbose 10
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[TestRunner] Running the tests in 'Launch_App' with parallel mode:false
[RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@7cf10a6f priority: 10
include groups [SMOKE]
 exclude groups: [] Scanarios location:  
[TestClass] Creating TestClass for [ClassImpl class=com.qmetry.qaf.automation.step.client.text.BDDTestFactory]
[TestNG] Running:
  /tmp/scratchE1xraV.scratch/test-packagel0A01c/testng.xml

[SuiteRunner] Created 1 TestRunners
[TestRunner] Running test Launch_App on 1  classes,  included groups:[SMOKE ] excluded groups:[]
===== Test class
com.qmetry.qaf.automation.step.client.text.BDDTestFactory
======
[TestNG] RUNNING: Suite: "Launch_App" containing "0" Tests (config: /tmp/scratchE1xraV.scratch/test-packagel0A01c/testng.xml)
===== Invoked methods
=====
Creating /tmp/customer_log_directoryz6SHdY/test-output/QAF Demo/Launch_App.html
Creating /tmp/customer_log_directoryz6SHdY/test-output/QAF Demo/Launch_App.xml

===============================================
    Launch_App
    Tests run: 0, Failures: 0, Skips: 0
===============================================

[TestNG] 
[TestNG] ===============================================
[TestNG]     Launch_App
[TestNG]     Tests run: 0, Failures: 0, Skips: 0
[TestNG] ===============================================

===============================================
QAF Demo
Total tests run: 0, Failures: 0, Skips: 0
===============================================

是因为QAF使用了自定义方法选择器吗?

1 个答案:

答案 0 :(得分:3)

要将QAF与AWS Device Farm集成,您可以按照以下步骤操作。

  1. 按照AWS所述,在您的项目中进行必需的配置。请参阅working with Appium on AWS Device Farm Documentation
  2. 在程序集zip文件中的以下文件夹中添加。您可以通过更新assembly/zip.xml来添加这些文件夹。
<fileSet>
    <directory>${project.basedir}</directory>
    <outputDirectory>./</outputDirectory>
    <includes>
      <include>/resources/</include>
      <include>/scenarios/</include>
      <include>/config/</include>
    </includes>
</fileSet>
  1. 现在使用mvn clean package -DskipTests=true命令构建zip。

  2. 点击相同的参考链接以上传测试包zip。

  3. 在配置yml文件中提供testng xml的路径。

java -Dappium.screenshots.dir=$DEVICEFARM_SCREENSHOT_PATH org.testng.TestNG "config/testrun_config.xml" -d $DEVICEFARM_LOG_DIR/test-output -verbose 10
  1. 移动QAF结果以构建工件文件夹以获取QAF结果。
post_test:
    commands:
      - cd $DEVICEFARM_TEST_PACKAGE_PATH
      - cp -R test-results $DEVICEFARM_LOG_DIR
      - cp -R img $DEVICEFARM_LOG_DIR
      - cp -R img $DEVICEFARM_SCREENSHOT_PATH