【问题标题】:Is there a way to run QAF BDD test on AWS device farm?有没有办法在 AWS 设备场上运行 QAF BDD 测试?
【发布时间】:2020-05-07 06:48:35
【问题描述】:

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

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 使用了自定义方法选择器吗?

【问题讨论】:

  • 它看起来没有找到任何 bdd 文件。您是否将资源和场景目录打包在 zip 中?提取后,它需要在执行目录中可用。
  • @user861594,我以与here 相同的方式打包成 zip。另外我在 pom.xml 中提到了&lt;testResources&gt; &lt;testResource&gt; &lt;directory&gt;${project.basedir}/config&lt;/directory&gt; &lt;/testResource&gt; &lt;/testResources&gt;,所以它可以找到 testng.xml
  • 我还需要做些什么来打包资源和场景吗?
  • 您是否已经尝试使用custom test environment 运行这些测试?它似乎更适合运行测试。如果您认为它特定于 AWS Device Farm,您可以尝试在 AWS Device Farm forums 上发布您遇到此问题的运行的 URL,以寻求他们的帮助。

标签: aws-device-farm qaf


【解决方案1】:

要将 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

【讨论】:

    猜你喜欢
    • 2021-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-15
    • 1970-01-01
    • 1970-01-01
    • 2018-03-08
    相关资源
    最近更新 更多