首页 > 解决方案 > Travis CI 上没有用于系统测试的输出

问题描述

在运行系统测试时,我在 Rails 6.0.4 应用程序上有一些奇怪的行为:rails test:system在我的机器上运行时,我正确地看到哪个错误失败,但在 Travis 中我只看到以下内容,没有任何提示哪个错误失败:

Puma starting in single mode...
* Version 4.3.8 (ruby 2.6.6-p146), codename: Mysterious Traveller
* Min threads: 0, max threads: 4
* Environment: test
* Listening on tcp://127.0.0.1:34339
Use Ctrl-C to stop
The command "bundle exec rails test:system" exited with 1.

唯一让我想到的是并行化,但是我尝试了使用和不使用该parallelize语句,test_helper.rb但不幸的是,它并没有太大变化。

这是 .travis.yml 的内容:

language: ruby
cache: bundler

before_install:
  - yes | gem update --system
  - gem install bundler

env:
  global:
    # CodeClimate : INI
    - COVERAGE=true
    - secure: #..................
    # CodeClimate : END

rvm:
  - 2.6.6

services:
  - mysql
  - mongodb

addons:
  apt:
    sources:
      - mysql-5.7-bionic
    packages:
      - mysql-server

dist: bionic

sudo: required

before_install:
  - yes | gem update --system
  - gem install bundler

before_script:
  # needed for system testing
  - sudo -- sh -c 'mkdir -p /var/run/puma/ && chown travis /var/run/puma/'
  - sudo -- sh -c 'mkdir -p /var/log/puma/ && chown travis /var/log/puma/'
  - sudo mysql_upgrade
  - sudo service mysql restart
  - RAILS_ENV=test bundle exec rake db:create db:schema:load

  # CodeClimate : INI
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
  - chmod +x ./cc-test-reporter
  - ./cc-test-reporter before-build
  # CodeClimate : END

script:
  - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bundle exec rails checks:all; fi
  - bundle exec rails test
  - bundle exec rails test:system

after_script:
  # CodeClimate : INI
  - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
  # CodeClimate : END

notifications:
  email:
    - developers@company.com

有关如何解决此问题的任何提示?

标签: ruby-on-railstestingintegration-testingtravis-cisystem-testing

解决方案


您是否尝试将以下内容添加到 .travis.yml:

addons:
  chrome: stable

推荐阅读