Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run single system test

To run a single test in Rails, we normally do:

rails test TEST=test/system/invitation_test.rb

But that doesn't work with system tests. Neither do this work:

rails test:system TEST=test/system/invitation_test.rb

With both those commandos above, all system tests (files) are run.

So my question is, how can I run a single system test?


As a side note, to run (all) system tests in Rails, you need to append :system to test.

rails test:system
like image 819
Fellow Stranger Avatar asked Apr 03 '17 15:04

Fellow Stranger


People also ask

How do you run a single Testcase?

If we want to execute a single test class, we can execute the command mvn test -Dtest=”TestClassName”. As the output shows, only the test class we've passed to the test parameter is executed.

How do you run a Minitest?

Setting Up Minitest. To run a Minitest test, the only setup you really need is to require the autorun file at the beginning of a test file: require 'minitest/autorun' . This is good if you'd like to keep the code small. A better way to get started with Minitest is to have Bundler create a template project for you.


1 Answers

While rails test doesn't seem to work if you want to run your system tests (you need to append test with :system), if you only want to run a single test it does seem to work:

rails test test/system/my_little_test.rb
like image 61
Fellow Stranger Avatar answered Sep 29 '22 23:09

Fellow Stranger