Open3

Railsのシステムテスト(System spec)の生い立ちを改めて調べる

Yusuke IwakiYusuke Iwaki

システムテスト導入のPR

https://github.com/rails/rails/pull/26703

I'm really excited to open this initial PR for bringing system/acceptance test support to Rails through Capybara.
The goal of this PR is for Rails to take on all the setup that is needed in applications to allow Capybara and make system testing default in Rails applications.

Railsで受け入れテストをCapybaraでサラッと導入できるようにするのが狙い。


ネーミングについては割と適当に決めた?w


Because Capybara and the test suite use 2 different threads, transactions aren't correctly rolled back at the end of the test, leaving data behind. For years DatabaseCleaner has been used to resolve this problem, but it's fixable in Rails. See PR Ensure test threads share a DB connection #28083

これが「CapybaraをRailsでサラッと使えるように」の枠を超えてる気がする。
「テストデータをつっこんで試験をして、試験後にロールバックする」というユースケースを想定している。

https://github.com/rails/rails/pull/28083

Yusuke IwakiYusuke Iwaki

https://github.com/rails/rails/pull/28096/files#diff-1506ea61f53afd4a699153985f623d7379840f8831ec837b5efdab8ba3aefacf

System tests

Pull Request

Rails 5.1 has support for writing Capybara tests baked in in the form of
System tests. Now you don't have to worry about configuring Capybara and
database cleaning strategies for such tests. Rails 5.1 provides a wrapper
for running such tests in chrome with additional features such as failure
screenshots.

Rails 5.1のリリースノート。やはりCapybaraを簡単にセットアップできて、DatabaseCleanerなしでいける点のみの記載。