trainer 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17bd8a4623eb7d2bf4906d4409e641c06f7da5ba
4
- data.tar.gz: 53d445c6312f5fa550ee91c43bef5bcbc675e082
3
+ metadata.gz: 0e3f70b7df496d9fabd93521f0570b31c8246c65
4
+ data.tar.gz: 5b905c28029b08d09b4c76784669b422c971843c
5
5
  SHA512:
6
- metadata.gz: 02bcab0a2e30632941f6dab76f649bed6d32f735636394ff79df6c856e861375942baa120c61b058b60b6f9dcbb555c1e41b8800a0e2898a8cf78cd5120be064
7
- data.tar.gz: 338d462b8b2394765a3d077f970197822d4a54becb33b505525ab26a8972ce9226632f0e0d73b599c103e44ab3db91c518ec9c222877407bf7dd50e72316443f
6
+ metadata.gz: 6f99d9bc8d6c6cd851d40d576edb4bebb5d1aa8928642c78ac66981b928e6fd6e8f9d2a404109344dfa205ef03aae389ce18e46240a79e36f760a2d52e2f46ad
7
+ data.tar.gz: e4b784d44beedac35cb637e08bebf9e674f8f91f19b4afaed9d2cb81b1d53c3d89ed8525d70e12365b7375d3f3fe28ba567f8a2edfad29adff88913e78d2bf27
@@ -33,7 +33,13 @@ module Trainer
33
33
  env_name: "TRAINER_FAIL_BUILD",
34
34
  description: "Should this step stop the build if the tests fail? Set this to false if you're handling this with a test reporter",
35
35
  is_string: false,
36
- default_value: true)
36
+ default_value: true),
37
+ FastlaneCore::ConfigItem.new(key: :xcpretty_naming,
38
+ short_option: "-x",
39
+ env_name: "TRAINER_XCPRETTY_NAMING",
40
+ description: "Produces class name and test name identical to xcpretty naming in junit file",
41
+ is_string: false,
42
+ default_value: false)
37
43
  ]
38
44
  end
39
45
  end
@@ -37,7 +37,7 @@ module Trainer
37
37
  to_path = path.gsub(".plist", config[:extension])
38
38
  end
39
39
 
40
- tp = Trainer::TestParser.new(path)
40
+ tp = Trainer::TestParser.new(path, config)
41
41
  File.write(to_path, tp.to_junit)
42
42
  puts "Successfully generated '#{to_path}'"
43
43
 
@@ -46,7 +46,7 @@ module Trainer
46
46
  return_hash
47
47
  end
48
48
 
49
- def initialize(path)
49
+ def initialize(path, config = {})
50
50
  path = File.expand_path(path)
51
51
  UI.user_error!("File not found at path '#{path}'") unless File.exist?(path)
52
52
 
@@ -55,7 +55,7 @@ module Trainer
55
55
  return if self.raw_json["FormatVersion"].to_s.length.zero? # maybe that's a useless plist file
56
56
 
57
57
  ensure_file_valid!
58
- parse_content
58
+ parse_content(config[:xcpretty_naming])
59
59
  end
60
60
 
61
61
  # Returns the JUnit report as String
@@ -107,8 +107,21 @@ module Trainer
107
107
  return tests
108
108
  end
109
109
 
110
+ # Returns the test group and test name from the passed summary and test
111
+ # Pass xcpretty_naming = true to get the test naming aligned with xcpretty
112
+ def test_group_and_name(testable_summary, test, xcpretty_naming)
113
+ if xcpretty_naming
114
+ group = testable_summary["TargetName"] + "." + test["TestIdentifier"].split("/")[0..-2].join(".")
115
+ name = test["TestName"][0..-3]
116
+ else
117
+ group = test["TestIdentifier"].split("/")[0..-2].join(".")
118
+ name = test["TestName"]
119
+ end
120
+ return group, name
121
+ end
122
+
110
123
  # Convert the Hashes and Arrays in something more useful
111
- def parse_content
124
+ def parse_content(xcpretty_naming)
112
125
  self.data = self.raw_json["TestableSummaries"].collect do |testable_summary|
113
126
  summary_row = {
114
127
  project_path: testable_summary["ProjectPath"],
@@ -116,10 +129,11 @@ module Trainer
116
129
  test_name: testable_summary["TestName"],
117
130
  duration: testable_summary["Tests"].map { |current_test| current_test["Duration"] }.inject(:+),
118
131
  tests: unfold_tests(testable_summary["Tests"]).collect do |current_test|
132
+ test_group, test_name = test_group_and_name(testable_summary, current_test, xcpretty_naming)
119
133
  current_row = {
120
134
  identifier: current_test["TestIdentifier"],
121
- test_group: current_test["TestIdentifier"].split("/")[0..-2].join("."),
122
- name: current_test["TestName"],
135
+ test_group: test_group,
136
+ name: test_name,
123
137
  object_class: current_test["TestObjectClass"],
124
138
  status: current_test["TestStatus"],
125
139
  guid: current_test["TestSummaryGUID"],
@@ -1,4 +1,4 @@
1
1
  module Trainer
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  DESCRIPTION = "Convert xcodebuild plist files to JUnit reports"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trainer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-14 00:00:00.000000000 Z
11
+ date: 2019-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plist
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  requirements: []
154
154
  rubyforge_project:
155
- rubygems_version: 2.6.10
155
+ rubygems_version: 2.5.2.3
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: Convert xcodebuild plist files to JUnit reports