Class: KnapsackPro::TestSuite
- Inherits:
-
Object
- Object
- KnapsackPro::TestSuite
- Defined in:
- lib/knapsack_pro/test_suite.rb
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
-
#calculate_test_files ⇒ Object
Detect test files present on the disk that should be run.
-
#fallback_test_files ⇒ Object
In Fallback Mode, we always want to run whole test files (not split by test cases) to guarantee that each test will be executed at least once across parallel CI nodes.
-
#initialize(adapter_class) ⇒ TestSuite
constructor
A new instance of TestSuite.
Constructor Details
#initialize(adapter_class) ⇒ TestSuite
Returns a new instance of TestSuite.
7 8 9 |
# File 'lib/knapsack_pro/test_suite.rb', line 7 def initialize(adapter_class) @adapter_class = adapter_class end |
Instance Method Details
#calculate_test_files ⇒ Object
Detect test files present on the disk that should be run. This may include fast test files + slow test files split by test cases.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/knapsack_pro/test_suite.rb', line 13 def calculate_test_files return @result if defined?(@result) unless adapter_class.split_by_test_cases_enabled? return @result = Result.new(all_test_files_to_run, true) end slow_test_files, quick = if slow_test_file_pattern [KnapsackPro::TestFileFinder.slow_test_files_by_pattern(adapter_class), true] else [KnapsackPro::SlowTestFileFinder.call(adapter_class), false] end KnapsackPro.logger.debug("Detected #{slow_test_files.size} slow test files: #{slow_test_files.inspect}") if slow_test_files.empty? return @result = Result.new(all_test_files_to_run, quick) end test_file_cases = adapter_class.test_file_cases_for(slow_test_files) fast_files_and_cases_for_slow_tests = KnapsackPro::TestFilesWithTestCasesComposer.call(all_test_files_to_run, slow_test_files, test_file_cases) @result = Result.new(fast_files_and_cases_for_slow_tests, false) end |
#fallback_test_files ⇒ Object
In Fallback Mode, we always want to run whole test files (not split by test cases) to guarantee that each test will be executed at least once across parallel CI nodes.
43 44 45 |
# File 'lib/knapsack_pro/test_suite.rb', line 43 def fallback_test_files all_test_files_to_run end |