Project

General

Profile

Actions

Feature #35030

closed

Allow parallel testing

Added by Go MAEDA almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Rails support
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

Rails 6.0 or later supports parallel testing. Enabling this feature can reduce the time required for testing and improve development efficiency.
https://guides.rubyonrails.org/testing.html#parallel-testing

By applying the following patch and run the test suite with PARALLEL_WORKERS=6 environment variable in my environment, the time required to run the test suite was reduced to about 30%.

diff --git a/test/test_helper.rb b/test/test_helper.rb
index 10f4f6e35..95b877d44 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -53,6 +53,8 @@ class ActionView::TestCase
 end

 class ActiveSupport::TestCase
+  parallelize(workers: 1)
+
   include ActionDispatch::TestProcess

   self.use_transactional_tests = true

The reason why the number of workers is set to 1 is that parallel testing causes some errors in system test.


Files

35030.patch (907 Bytes) 35030.patch Go MAEDA, 2021-04-06 02:19
Actions

Also available in: Atom PDF