Sha256: 8f697074df28528f25d5da6b005a37af4c92b3604034b20f69819d18cfd29200

Contents?: true

Size: 1.35 KB

Versions: 18

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

module KnapsackPro
  class SlowTestFileFinder
    # Get recorded test files from API.
    # Find slow tests among them that are still present on the disk.
    # Save slow test files in json file on the disk.
    # Returns slow test files.
    def self.call(adapter_class)
      if KnapsackPro::Config::Env.test_files_encrypted?
        raise "Split by test cases is not possible when you have enabled test file names encryption ( #{KnapsackPro::Urls::ENCRYPTION} ). You need to disable encryption with KNAPSACK_PRO_TEST_FILES_ENCRYPTED=false in order to use split by test cases #{KnapsackPro::Urls::SPLIT_BY_TEST_EXAMPLES}"
      end

      # get list of recorded test files for last CI Build
      build_distribution_entity = KnapsackPro::BuildDistributionFetcher.call
      test_files_from_api = build_distribution_entity.test_files

      merged_test_files_from_api = KnapsackPro::TestCaseMergers::BaseMerger.call(adapter_class, test_files_from_api)

      test_files_existing_on_disk = KnapsackPro::TestFileFinder.select_test_files_that_can_be_run(adapter_class, merged_test_files_from_api)

      slow_test_files = KnapsackPro::SlowTestFileDeterminer.call(test_files_existing_on_disk, build_distribution_entity.time_execution)

      KnapsackPro::SlowTestFileDeterminer.save_to_json_report(slow_test_files)

      slow_test_files
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
knapsack_pro-7.9.0 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.8.2 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.8.1 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.8.0 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.7.0 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.6.2 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.6.1 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.6.0 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.1.0 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.0.1 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.0.0 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-6.0.4 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-6.0.3 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-6.0.2 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-6.0.1 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-6.0.0 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-5.7.0 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-5.6.0 lib/knapsack_pro/slow_test_file_finder.rb