好吧,所以我试图通过他们在 CircleCI 中的时间来拆分我的 Appium 测试,以便并行运行测试。我的测试是用 behave(Python) 编写的,我正在生成 JUnit XML 文件。这是我的 config.yml 文件
version: 2.1
orbs:
macos: circleci/[email protected]
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
当我运行测试时,我收到错误消息“没有找到“features/featurefiles/XXX.feature”的时间并且它正在按文件名拆分测试。它运行良好但拆分没有发生时机。
执行完成后,我可以在 TESTS 选项卡中看到数据,也在 Timing 选项卡中
我相信 CircleCI 无法读取由 Behave 生成的 JUnit 文件,它正在搜索不同的 JUnit XML 文件。我们如何让 CircleCI 读取 Behave 生成的 JUnit 文件?
如果有人遇到此类问题,请查看 JUnit 报告中的类名。 CircleCI 读取类名有一种格式。在我的例子中,JUnit 报告中的类名被称为
features.featurefiles.Login.feature
但是 CircleCI 正在寻找以下格式的类名
features/featurefiles/Login.feature
一旦执行完成,我必须编写一个实用程序来更改报告中的类名。一旦完成,CircleCI 就能够读取时间。
希望它能帮助别人:)