在按计时拆分测试时,CircleCI无法读取Behave生成的JUnit xml

63lcw9qa  于 2022-11-11  发布在  其他
关注(0)|答案(1)|浏览(74)

好的,我尝试按照CircleCI中的时间划分Appium测试,以便并行运行测试。

version: 2.1
orbs:
  macos: circleci/macos@2.2.0

jobs:
  example-job:      
macos:
  xcode: 13.4.1

parallelism: 4  

resource_class: large

steps:
  - checkout
  - run:
      name: Install appium server
      command: |
        sudo npm update -g
        sudo npm install -g appium
        sudo npm install -g wd
  - run:
      name: Start appium server
      command: appium --address localhost --port 4723
      background: true

  - run:
      name: Installing Dependencies
      command: pip3 install -r requirements.txt

  - run:
      name: Test application
      command: |
                TEST=$(circleci tests glob "features/featurefiles/*.feature" | circleci tests split --split-by=timings --timings-type=classname)
                echo $TEST
                behave $TEST --junit     

  - store_test_results:
      path: reports

  - store_artifacts:
      path: ./Logs
      destination: logs-file

  - store_artifacts:
      path: ./screenshots

workflows:
  example-workflow:
jobs:
  - example-job

当我运行测试时,我得到错误“No timing found for“features/featurefiles/XXX.feature”,并且它按文件名拆分测试。它运行良好,但拆分未按时间发生。
执行完成后,我可以在“TESTS”选项卡和“Timing”选项卡中看到数据

我相信CircleCI无法读取Behave生成的JUnit文件,它正在搜索不同的JUnit XML文件。我们如何才能使CircleCI读取Behave生成的JUnit文件?

esyap4oy

esyap4oy1#

如果有人遇到这样的问题,请看一下JUnit报告中的类名。

features.featurefiles.Login.feature

但CircleCI正在查找以下格式的类名

features/featurefiles/Login.feature

我必须编写一个实用程序,在执行完成后更改报告中的类名。
希望它能帮助一些人:)

相关问题