CircleCI:如何配置测试结果存储?
CircleCI: How do I configure test result storage?
我在 CircleCI 环境中使用 Cypress 集成测试。目前我的 CircleCI 配置无法将测试报告存储为工件并包含摘要。屏幕截图和视频已成功存储。我包括 config.yml
和 CircleCI 仪表板的屏幕截图。
我查阅了 CircleCI 文档的这些页面:
并注意到我的问题与 的相似之处。
如有指点,我们将不胜感激。谢谢!
config.yml
version: 2
jobs:
build:
working_directory: ~/nodefront
docker:
- image: cypress/base:6
environment:
TERM: xterm
parallelism: 1
steps:
- checkout
- restore_cache:
name: Restoring cached yarn dependencies
key: v3-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
- run:
name: Installing dependencies with yarn
command: |
yarn install --frozen-lockfile
yarn list
- save_cache:
name: Caching yarn dependencies
key: v3-deps-{{ checksum "package.json" }}
paths:
- ~/.cache
- run: mkdir -p integration-tests/test-results/junit integration-tests/cypress/videos integration-tests/cypress/screenshots
- run:
name: Running E2E tests with JUnit reporter
command: $(yarn bin)/cypress run --project ./integration-tests --reporter junit --record --key 77ffe06e-0fe2-4b33-a5ff-4dcdf9e31c91
environment:
MOCHA_FILE: integration-tests/test-results/junit/test-results-[hash].xml
when: always
- store_test_results:
path: integration-tests/test-results
- store_artifacts:
path: integration-tests/test-results
- store_artifacts:
path: integration-tests/cypress/videos
- store_artifacts:
path: integration-tests/cypress/screenshots
截图
嗯,自从我 posted 以来,存储库的结构发生了一些重大变化......但我会 post [=23= 的相关部分]这里。我无法确定我们做了什么来修复它,但其中一部分是为 Cypress 子文件夹 (integration-tests) 提供自己的 package.json,将相关脚本放在那里,然后进行更清洁的 .circleci/config.yml。我们取出了mkdir
语句和环境对象
test_cypress:
working_directory: ~/theintercept
docker:
- image: cypress/base:6
environment:
TERM: xterm
parallelism: 1
steps:
- checkout
- restore_cache:
name: Restoring cached yarn dependencies
keys:
- integration-tests-yarn-dependencies-{{ checksum "integration-tests/yarn.lock" }}
- run:
name: Installing dependencies with yarn
command: |
cd integration-tests
yarn install --frozen-lockfile
yarn list
- save_cache:
name: Caching yarn dependencies
key: integration-tests-yarn-dependencies-{{ checksum "integration-tests/yarn.lock" }}
paths:
- ~/.cache/Cypress
- ~/.cache/yarn
- ~/theintercept/integration-tests/node_modules
- run:
name: Running E2E tests with JUnit reporter
command: |
cd integration-tests
yarn test:record
- store_test_results:
path: integration-tests/test-results
- store_artifacts:
path: integration-tests/test-results
- store_artifacts:
path: integration-tests/test-artifacts
我在 CircleCI 环境中使用 Cypress 集成测试。目前我的 CircleCI 配置无法将测试报告存储为工件并包含摘要。屏幕截图和视频已成功存储。我包括 config.yml
和 CircleCI 仪表板的屏幕截图。
我查阅了 CircleCI 文档的这些页面:
并注意到我的问题与
如有指点,我们将不胜感激。谢谢!
config.yml
version: 2
jobs:
build:
working_directory: ~/nodefront
docker:
- image: cypress/base:6
environment:
TERM: xterm
parallelism: 1
steps:
- checkout
- restore_cache:
name: Restoring cached yarn dependencies
key: v3-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
- run:
name: Installing dependencies with yarn
command: |
yarn install --frozen-lockfile
yarn list
- save_cache:
name: Caching yarn dependencies
key: v3-deps-{{ checksum "package.json" }}
paths:
- ~/.cache
- run: mkdir -p integration-tests/test-results/junit integration-tests/cypress/videos integration-tests/cypress/screenshots
- run:
name: Running E2E tests with JUnit reporter
command: $(yarn bin)/cypress run --project ./integration-tests --reporter junit --record --key 77ffe06e-0fe2-4b33-a5ff-4dcdf9e31c91
environment:
MOCHA_FILE: integration-tests/test-results/junit/test-results-[hash].xml
when: always
- store_test_results:
path: integration-tests/test-results
- store_artifacts:
path: integration-tests/test-results
- store_artifacts:
path: integration-tests/cypress/videos
- store_artifacts:
path: integration-tests/cypress/screenshots
截图
嗯,自从我 posted 以来,存储库的结构发生了一些重大变化......但我会 post [=23= 的相关部分]这里。我无法确定我们做了什么来修复它,但其中一部分是为 Cypress 子文件夹 (integration-tests) 提供自己的 package.json,将相关脚本放在那里,然后进行更清洁的 .circleci/config.yml。我们取出了mkdir
语句和环境对象
test_cypress:
working_directory: ~/theintercept
docker:
- image: cypress/base:6
environment:
TERM: xterm
parallelism: 1
steps:
- checkout
- restore_cache:
name: Restoring cached yarn dependencies
keys:
- integration-tests-yarn-dependencies-{{ checksum "integration-tests/yarn.lock" }}
- run:
name: Installing dependencies with yarn
command: |
cd integration-tests
yarn install --frozen-lockfile
yarn list
- save_cache:
name: Caching yarn dependencies
key: integration-tests-yarn-dependencies-{{ checksum "integration-tests/yarn.lock" }}
paths:
- ~/.cache/Cypress
- ~/.cache/yarn
- ~/theintercept/integration-tests/node_modules
- run:
name: Running E2E tests with JUnit reporter
command: |
cd integration-tests
yarn test:record
- store_test_results:
path: integration-tests/test-results
- store_artifacts:
path: integration-tests/test-results
- store_artifacts:
path: integration-tests/test-artifacts