首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CircleCI:如何配置测试结果存储?

CircleCI:如何配置测试结果存储?
EN

Stack Overflow用户
提问于 2018-07-23 21:13:40
回答 1查看 1.2K关注 0票数 1

我在CircleCI环境中使用Cypress集成测试。目前,我的CircleCI配置无法将测试报告存储为工件,并包含一个摘要。截图和视频被成功地存储起来。我包括config.yml和CircleCI仪表板的截图。

我查阅了CircleCI文档的这些页面:

并注意到我的问题与“CircleCI中未填充测试结果的测试摘要”的相似之处。

如有任何指示,将不胜感激。谢谢!

config.yml

代码语言:javascript
复制
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

截图

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-07-27 16:51:47

好吧,自从我贴出仓库里有一些重大的结构变化.但是我会在这里发布config.yml的相关部分。我无法确定我们为修复它做了什么,但是它的一部分是给Cypress子文件夹(集成-测试)自己的package.json,将相关的脚本放在里面,然后使用一个更干净的.循环/config.yml。我们取出了mkdir语句和环境对象。

代码语言:javascript
复制
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
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51487313

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档