【发布时间】:2021-09-28 10:32:17
【问题描述】:
在运行系统测试时,我在 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.
我唯一想到的是并行化,但我尝试了在 test_helper.rb 中使用和不使用 parallelize 语句,但遗憾的是它并没有太大变化。
这是.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-rails testing integration-testing travis-ci system-testing