首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >亚马逊网络服务CodeBuild测试报告为空

亚马逊网络服务CodeBuild测试报告为空
EN

Stack Overflow用户
提问于 2020-04-09 07:31:50
回答 1查看 680关注 0票数 0

因此,我创建并部署了一个教程AWS CodeStar项目[https://github.com/aamalik7196/Testv4]。这些文件是由AWS自己创建的,用于运行一个简单的Hello World示例项目。

我更改的唯一更改是在buildspec.yml文件中创建测试报告,如下所示:

代码语言:javascript
复制
version: 0.2

phases:
  install:
    runtime-versions:
      python: 3.8
    commands:

      # Upgrade AWS CLI to the latest version
      - pip install --upgrade awscli

  pre_build:
    commands:

      # Discover and run unit tests in the 'tests' directory. For more information, see <https://docs.python.org/3/library/unittest.html#test-discovery>
      - python -m unittest discover tests

  build:
    commands:

      # Use AWS SAM to package the application by using AWS CloudFormation
      - aws cloudformation package --template template.yml --s3-bucket $S3_BUCKET --output-template template-export.yml

      # Do not remove this statement. This command is required for AWS CodeStar projects.
      # Update the AWS Partition, AWS Region, account ID and project ID in the project ARN on template-configuration.json file so AWS CloudFormation can tag project resources.
      - sed -i.bak 's/\$PARTITION\$/'${PARTITION}'/g;s/\$AWS_REGION\$/'${AWS_REGION}'/g;s/\$ACCOUNT_ID\$/'${ACCOUNT_ID}'/g;s/\$PROJECT_ID\$/'${PROJECT_ID}'/g' template-configuration.json

  # post-build:
  #   commands:
  #     - echo In post build phase

# only part added
reports:
  TestReport: # CodeBuild will create a report group called "TestReport".
    files: #Store all of the files
      - '**/*'

artifacts:
  files:
    - template-export.yml
    - template-configuration.json

存储库包含一个文件夹,用于执行简单的测试。使用亚马逊网络服务CodeStar成功地进行了构建和部署,但是当我去查看reports选项卡时,它是空的。我知道测试实际上是在构建日志中运行的,但是报告是空的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-04-10 17:27:35

运行find ./以确认测试结果文件已生成。另外,在'reports‘部分,指定确切的文件名。

下面是我用来检查和确认功能的构建规范示例:

代码语言:javascript
复制
version: 0.2

phases:
  install:
    runtime-versions:
      python: 3.8
  pre_build:
    commands:
      - aws --version
  post_build:
    commands:
      - wget https://raw.githubusercontent.com/qmetry/cucumber-javascript-example/master/test-result.json
      - find ./ 

reports:
  rspec:
    files:
      - 'test-result.json'
    file-format: CucumberJson
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61111651

复制
相关文章

相似问题

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