AWS Отчет о тестировании CodeBuild пуст - PullRequest
0 голосов
/ 09 апреля 2020

Итак, я создал и развернул учебник AWS Проект CodeStar [https://github.com/aamalik7196/Testv4] . Файлы создаются самим AWS для запуска простого примера проекта Hello World.

единственное изменение, которое я изменил, - это файл buildspe c .yml для создания отчетов для тестирования следующим образом:

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

репо содержит папку для проведения простого теста. сборка и развертывание происходит успешно [с использованием AWS CodeStar], но когда я go вижу вкладку отчетов, она пуста. Я точно знаю, что тест был выполнен в журнале сборки, но отчеты пустые.

1 Ответ

0 голосов
/ 10 апреля 2020

Запустите find ./, чтобы убедиться, что файл результатов теста сгенерирован. Также в разделе «отчеты» укажите точное имя файла.

Вот пример сборки c Я использовал для проверки и подтверждения функциональности:

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
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...