Class: Pod::TestResult
- Inherits:
-
Object
- Object
- Pod::TestResult
- Defined in:
- lib/cocoapods-unit-test/result.rb
Instance Attribute Summary collapse
-
#cov_path ⇒ Object
Returns the value of attribute cov_path.
-
#json_path ⇒ Object
Returns the value of attribute json_path.
Instance Method Summary collapse
- #dump_json_to_file(result, file) ⇒ Object
-
#initialize(json_path, cov_path) ⇒ TestResult
constructor
A new instance of TestResult.
- #load_json_from_file ⇒ Object
- #parse ⇒ Object
- #parse_cov_result ⇒ Object
- #parse_json_result ⇒ Object
Constructor Details
#initialize(json_path, cov_path) ⇒ TestResult
11 12 13 14 |
# File 'lib/cocoapods-unit-test/result.rb', line 11 def initialize(json_path, cov_path) @json_path = File.(json_path) @cov_path = File.(cov_path) end |
Instance Attribute Details
#cov_path ⇒ Object
Returns the value of attribute cov_path.
8 9 10 |
# File 'lib/cocoapods-unit-test/result.rb', line 8 def cov_path @cov_path end |
#json_path ⇒ Object
Returns the value of attribute json_path.
9 10 11 |
# File 'lib/cocoapods-unit-test/result.rb', line 9 def json_path @json_path end |
Instance Method Details
#dump_json_to_file(result, file) ⇒ Object
49 50 51 52 53 |
# File 'lib/cocoapods-unit-test/result.rb', line 49 def dump_json_to_file(result, file) File.open(file,"w") do |w| w.write(JSON.neat_generate(result, sort:true, wrap:true, after_colon:1)) end end |
#load_json_from_file ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/cocoapods-unit-test/result.rb', line 41 def load_json_from_file if File.file?(json_path) json_file = File.open json_path return JSON.load json_file end {} end |
#parse ⇒ Object
36 37 38 39 |
# File 'lib/cocoapods-unit-test/result.rb', line 36 def parse parse_json_result parse_cov_result end |
#parse_cov_result ⇒ Object
32 33 34 |
# File 'lib/cocoapods-unit-test/result.rb', line 32 def parse_cov_result ## line_cov fun_cov headerCovTableEntry end |
#parse_json_result ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cocoapods-unit-test/result.rb', line 16 def parse_json_result ## build_success, tests_count, tests_failed_count load_json_from_file.fetch("metrics", {}).tap { |result| UI.puts "Test case count :" + result.fetch("testsCount", {}).fetch("_value", 0).to_s UI.puts "Test case fail count :" + result.fetch("testsFailedCount", {}).fetch("_value", 0).to_s result.fetch("issues", {}).fetch("errorSummaries", {}).fetch("_values", []).each { |issues| UI.puts "❌ #{issues.fetch("issueType", {}).fetch("_value", "").to_s} -> #{issues.fetch("message", {}).fetch("_value", "").to_s}" } result.fetch("issues", {}).fetch("testFailureSummaries", {}).fetch("_values", []).each { |issues| UI.puts "❌ #{issues.fetch("testCaseName", {}).fetch("_value", "").to_s} -> #{issues.fetch("message", {}).fetch("_value", "").to_s}" } } end |