Class: Fastlane::Actions::TestsFromJunitAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/retry_tests/actions/tests_from_junit.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



50
51
52
# File 'lib/fastlane/plugin/retry_tests/actions/tests_from_junit.rb', line 50

def self.authors
  ["lyndsey-ferguson/lyndseydf"]
end

.available_optionsObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fastlane/plugin/retry_tests/actions/tests_from_junit.rb', line 33

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :junit,
      env_name: "FL_SUPPRESS_TESTS_FROM_JUNIT_JUNIT_REPORT", # The name of the environment variable
      description: "The junit xml report file from which to collect the tests to suppress",
      verify_block: proc do |path|
        UI.user_error!("Error: cannot find the junit xml report file '#{path}'") unless File.exist?(path)
      end
    )
  ]
end

.descriptionObject



29
30
31
# File 'lib/fastlane/plugin/retry_tests/actions/tests_from_junit.rb', line 29

def self.description
  "Retrieves the failing and passing tests as reported in a junit xml file"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/fastlane/plugin/retry_tests/actions/tests_from_junit.rb', line 54

def self.is_supported?(platform)
  platform == :ios
end

.return_valueObject



46
47
48
# File 'lib/fastlane/plugin/retry_tests/actions/tests_from_junit.rb', line 46

def self.return_value
  "A Hash with an Array of :passing and :failed tests"
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fastlane/plugin/retry_tests/actions/tests_from_junit.rb', line 4

def self.run(params)
  report = ::TestCenter::Helper::XcodeJunit::Report.new(params[:junit])
  passing = []
  failed = []
  report.testables.each do |testable|
    testable.testsuites.each do |testsuite|
      testsuite.testcases.each do |testcase|
        if testcase.passed?
          passing << testcase.identifier
        else
          failed << testcase.identifier
        end
      end
    end
  end
  {
    failed: failed,
    passing: passing
  }
end