swiftrail 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 644bf67a0db0447a400e42b54b8e956941d6368ac8a0955ce93309117301c1fc
4
+ data.tar.gz: a20f2a2931a777420512d0f739a9f4e3ce8817bb7fa0ce3164eb7b8c39768020
5
+ SHA512:
6
+ metadata.gz: 9341f64cb2a50454c6c045da1839d86958a4d87d00b0b7793411d6d3a289602737d49da9ba0a2840da92093947dd6843dc297974f61dab443f533f5f71b98dea
7
+ data.tar.gz: 1697f0c9be55a206d276e75f06efa1d2c2fe11ab4c80f11081582bfcef42c228862ac88e4487bc039cf8cc492396f474973139cdf4dde12bd067ff244b9dcbce
data/.gitignore ADDED
@@ -0,0 +1,198 @@
1
+
2
+ # Created by https://www.gitignore.io/api/ruby,rubymine,rubymine+all
3
+ # Edit at https://www.gitignore.io/?templates=ruby,rubymine,rubymine+all
4
+
5
+ ### Ruby ###
6
+ *.gem
7
+ *.rbc
8
+ /.config
9
+ /coverage/
10
+ /InstalledFiles
11
+ /pkg/
12
+ /spec/reports/
13
+ /spec/examples.txt
14
+ /test/tmp/
15
+ /test/version_tmp/
16
+ /tmp/
17
+
18
+ # Used by dotenv library to load environment variables.
19
+ # .env
20
+
21
+ # Ignore Byebug command history file.
22
+ .byebug_history
23
+
24
+ ## Specific to RubyMotion:
25
+ .dat*
26
+ .repl_history
27
+ build/
28
+ *.bridgesupport
29
+ build-iPhoneOS/
30
+ build-iPhoneSimulator/
31
+
32
+ ## Specific to RubyMotion (use of CocoaPods):
33
+ #
34
+ # We recommend against adding the Pods directory to your .gitignore. However
35
+ # you should judge for yourself, the pros and cons are mentioned at:
36
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
37
+ # vendor/Pods/
38
+
39
+ ## Documentation cache and generated files:
40
+ /.yardoc/
41
+ /_yardoc/
42
+ /doc/
43
+ /rdoc/
44
+
45
+ ## Environment normalization:
46
+ /.bundle/
47
+ /vendor/bundle
48
+ /lib/bundler/man/
49
+
50
+ # for a library or gem, you might want to ignore these files since the code is
51
+ # intended to run in multiple environments; otherwise, check them in:
52
+ # Gemfile.lock
53
+ # .ruby-version
54
+ # .ruby-gemset
55
+
56
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
57
+ .rvmrc
58
+
59
+ ### RubyMine ###
60
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
61
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
62
+
63
+ # User-specific stuff
64
+ .idea/**/workspace.xml
65
+ .idea/**/tasks.xml
66
+ .idea/**/usage.statistics.xml
67
+ .idea/**/dictionaries
68
+ .idea/**/shelf
69
+
70
+ # Generated files
71
+ .idea/**/contentModel.xml
72
+
73
+ # Sensitive or high-churn files
74
+ .idea/**/dataSources/
75
+ .idea/**/dataSources.ids
76
+ .idea/**/dataSources.local.xml
77
+ .idea/**/sqlDataSources.xml
78
+ .idea/**/dynamic.xml
79
+ .idea/**/uiDesigner.xml
80
+ .idea/**/dbnavigator.xml
81
+
82
+ # Gradle
83
+ .idea/**/gradle.xml
84
+ .idea/**/libraries
85
+
86
+ # Gradle and Maven with auto-import
87
+ # When using Gradle or Maven with auto-import, you should exclude module files,
88
+ # since they will be recreated, and may cause churn. Uncomment if using
89
+ # auto-import.
90
+ # .idea/modules.xml
91
+ # .idea/*.iml
92
+ # .idea/modules
93
+
94
+ # CMake
95
+ cmake-build-*/
96
+
97
+ # Mongo Explorer plugin
98
+ .idea/**/mongoSettings.xml
99
+
100
+ # File-based project format
101
+ *.iws
102
+
103
+ # IntelliJ
104
+ out/
105
+
106
+ # mpeltonen/sbt-idea plugin
107
+ .idea_modules/
108
+
109
+ # JIRA plugin
110
+ atlassian-ide-plugin.xml
111
+
112
+ # Cursive Clojure plugin
113
+ .idea/replstate.xml
114
+
115
+ # Crashlytics plugin (for Android Studio and IntelliJ)
116
+ com_crashlytics_export_strings.xml
117
+ crashlytics.properties
118
+ crashlytics-build.properties
119
+ fabric.properties
120
+
121
+ # Editor-based Rest Client
122
+ .idea/httpRequests
123
+
124
+ # Android studio 3.1+ serialized cache file
125
+ .idea/caches/build_file_checksums.ser
126
+
127
+ # JetBrains templates
128
+ **___jb_tmp___
129
+
130
+ ### RubyMine Patch ###
131
+ # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
132
+
133
+ # *.iml
134
+ # modules.xml
135
+ # .idea/misc.xml
136
+ # *.ipr
137
+
138
+ # Sonarlint plugin
139
+ .idea/sonarlint
140
+
141
+ ### RubyMine+all ###
142
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
143
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
144
+
145
+ # User-specific stuff
146
+
147
+ # Generated files
148
+
149
+ # Sensitive or high-churn files
150
+
151
+ # Gradle
152
+
153
+ # Gradle and Maven with auto-import
154
+ # When using Gradle or Maven with auto-import, you should exclude module files,
155
+ # since they will be recreated, and may cause churn. Uncomment if using
156
+ # auto-import.
157
+ # .idea/modules.xml
158
+ # .idea/*.iml
159
+ # .idea/modules
160
+
161
+ # CMake
162
+
163
+ # Mongo Explorer plugin
164
+
165
+ # File-based project format
166
+
167
+ # IntelliJ
168
+
169
+ # mpeltonen/sbt-idea plugin
170
+
171
+ # JIRA plugin
172
+
173
+ # Cursive Clojure plugin
174
+
175
+ # Crashlytics plugin (for Android Studio and IntelliJ)
176
+
177
+ # Editor-based Rest Client
178
+
179
+ # Android studio 3.1+ serialized cache file
180
+
181
+ # JetBrains templates
182
+
183
+ ### RubyMine+all Patch ###
184
+ # Ignores the whole .idea folder and all .iml files
185
+ # See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
186
+
187
+ .idea/
188
+
189
+ # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
190
+
191
+ *.iml
192
+ modules.xml
193
+ .idea/misc.xml
194
+ *.ipr
195
+
196
+ # Sonarlint plugin
197
+
198
+ # End of https://www.gitignore.io/api/ruby,rubymine,rubymine+all
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ Metrics/LineLength:
2
+ Max: 170
3
+ Style/Documentation:
4
+ Enabled: false
5
+ Style/ExpandPathArguments:
6
+ Enabled: false
7
+ Style/FrozenStringLiteralComment:
8
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.1
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.2
7
+ before_install: gem install bundler -v 2.0.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at slavko.krucaj@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in swiftrail.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ swiftrail (0.1.2)
5
+ nokogiri (~> 1.10)
6
+ thor (~> 0.20)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.3)
12
+ mini_portile2 (2.4.0)
13
+ nokogiri (1.10.2)
14
+ mini_portile2 (~> 2.4.0)
15
+ rake (10.5.0)
16
+ rspec (3.8.0)
17
+ rspec-core (~> 3.8.0)
18
+ rspec-expectations (~> 3.8.0)
19
+ rspec-mocks (~> 3.8.0)
20
+ rspec-core (3.8.0)
21
+ rspec-support (~> 3.8.0)
22
+ rspec-expectations (3.8.2)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.8.0)
25
+ rspec-mocks (3.8.0)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.8.0)
28
+ rspec-support (3.8.0)
29
+ thor (0.20.3)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ bundler (~> 2.0)
36
+ rake (~> 10.0)
37
+ rspec (~> 3.0)
38
+ swiftrail!
39
+
40
+ BUNDLED WITH
41
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Slavko Krucaj
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # Swiftrail
2
+
3
+ A gem command line tool to help with assembling test reports and pairing them with the [testrail](https://www.gurock.com/testrail) test cases
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'swiftrail'
11
+ ```
12
+
13
+ And then execute:
14
+ ```
15
+ $ bundle
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ### Options
21
+
22
+ Mandatory options for all of the commands are
23
+
24
+ - `--test_classes=''` - regex for the path to swift tests
25
+ - `--test_rail_username=''` - username for TestRail account
26
+ - `--test_rail_password=''` - password for TestRail account
27
+ - `--test_rail_url=''` - url for TestRail account
28
+ - `--run_id=''` - run_id for which you want to run the command
29
+
30
+ When running report you additionaly have to pass location of the test_reports
31
+ - `--test-reports=''`
32
+
33
+ ### Marking test cases
34
+
35
+ In your `swift` projects you can mark any test class or specific test with any number of TestRail test cases. To mark them
36
+ specify the `//testrail` and after that just list the corresponding **case**-ids. Example
37
+
38
+ ```swift
39
+ //testrail C12344
40
+ class MyTests: XCTestCase {
41
+
42
+ //testrail C12344, C3267231
43
+ func test_first() {
44
+ }
45
+
46
+ //testrail C15
47
+ func test_second() {
48
+ }
49
+
50
+ func test_third() {
51
+ }
52
+ }
53
+
54
+ class MyOtherTests: XCTestCase {
55
+
56
+ //testrail C5555
57
+ func test_four() {
58
+ }
59
+
60
+ //testrail C15
61
+ func test_five() {
62
+ }
63
+
64
+ func test_six() {
65
+ }
66
+ }
67
+ ```
68
+ ### Report
69
+
70
+ To be able to report the results of the tests, you need to first generate xml junit reports. Once you have those, running
71
+ ```
72
+ swiftrail report --test-reports='path/to/test/reports' --run_id:123 (all the other options should also be listed)
73
+ ```
74
+ will report the results to TestRail. Dependent on success/failure the tests on TestRail will be marked accordingly.
75
+
76
+ ### Coverage
77
+
78
+ Coverage report will give you the percentage of test cases covered by your ui/unit/... tests.
79
+
80
+ ```
81
+ swiftrail coverage --run_id:123 (all the other options should also be listed)
82
+ ```
83
+
84
+ ### Lint
85
+
86
+ Lint will give you outadet case_ids that you have marked on your ui/unit tests, but no longer exist as test cases on TestRail.
87
+
88
+ ```
89
+ swiftrail lint --run_id:123 (all the other options should also be listed)
90
+ ```
91
+
92
+ ## Contributing
93
+
94
+ Bug reports and pull requests are welcome on GitHub at https://github.com/slavkokrucaj/swiftrail. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
95
+
96
+ ## License
97
+
98
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
99
+
100
+ ## Code of Conduct
101
+
102
+ Everyone interacting in the Swiftrail project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/slavkokrucaj/swiftrail/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/swiftrail ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ require 'swiftrail/cli'
3
+ require 'swiftrail/testrail/coverage'
4
+ require 'swiftrail/testrail/lint'
5
+
6
+ begin
7
+ Swiftrail::Cli.start
8
+ rescue Swiftrail::Errors::Base => e
9
+ warn e
10
+ exit(false)
11
+ end
@@ -0,0 +1,71 @@
1
+ require 'thor'
2
+ require 'swiftrail'
3
+ require 'swiftrail/config/reader'
4
+
5
+ module Swiftrail
6
+ class Cli < Thor
7
+ private
8
+
9
+ def self.defaults
10
+ @defaults ||= Config::Reader.new.defaults
11
+ end
12
+
13
+ public
14
+
15
+ class_option :test_classes, type: :string, default: defaults['test_classes'], desc: 'Regex to match your tests.'
16
+ class_option :test_rail_username, type: :string, default: defaults['test_rail_username'], desc: 'Username for your test rail account.'
17
+ class_option :test_rail_password, type: :string, default: defaults['test_rail_password'], desc: 'Password for your test rail account.'
18
+ class_option :test_rail_url, type: :string, default: defaults['test_rail_url'], desc: 'Base url for your testrail account.'
19
+ class_option :run_id, type: :string, default: defaults['run_id'], desc: 'Test Rail run id for which you\'re executing an action'
20
+
21
+ desc 'report', 'Reports success/failure to test rail, based on the results of your tests'
22
+ method_option :test_reports, type: :string, aliases: '-reports', default: defaults['reports'], desc: 'Regex to match your junit report files.'
23
+ def report
24
+ if swiftrail_reporter.report_results(options[:run_id])
25
+ puts 'Successfully reported the results'
26
+ else
27
+ puts 'There was an issue while reporting the results'
28
+ end
29
+ end
30
+
31
+ desc 'coverage', 'Reports coverage of all the tests on testrail account'
32
+ def coverage
33
+ puts(swiftrail_coverage.coverage_report(options[:run_id]))
34
+ end
35
+
36
+ desc 'lint', 'Reports case ids that are missing on testrail account'
37
+ def lint
38
+ puts(swiftrail_lint.lint_report(options[:run_id]))
39
+ end
40
+
41
+ private
42
+
43
+ def swiftrail_reporter
44
+ Swiftrail::Testrail::Reporter.new(
45
+ [options['test_reports']],
46
+ [options['test_classes']],
47
+ options['test_rail_username'],
48
+ options['test_rail_password'],
49
+ options['test_rail_url']
50
+ )
51
+ end
52
+
53
+ def swiftrail_coverage
54
+ Swiftrail::Testrail::Coverage.new(
55
+ [options['test_classes']],
56
+ options['test_rail_username'],
57
+ options['test_rail_password'],
58
+ options['test_rail_url']
59
+ )
60
+ end
61
+
62
+ def swiftrail_lint
63
+ Swiftrail::Testrail::Lint.new(
64
+ [options['test_classes']],
65
+ options['test_rail_username'],
66
+ options['test_rail_password'],
67
+ options['test_rail_url']
68
+ )
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,13 @@
1
+ require 'swiftrail/errors/error'
2
+
3
+ module Swiftrail
4
+ module Config
5
+ module Error
6
+ class InvalidFile < Errors::Base
7
+ def initialize(file)
8
+ super("Config file (#{file}) for swiftrail is not valid")
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,41 @@
1
+ require 'yaml'
2
+
3
+ module Swiftrail
4
+ module Config
5
+ class Reader
6
+ def defaults
7
+ raise Error::InvalidFile(defaults_file_name) unless valid_file?
8
+
9
+ base_defaults.merge(file_defaults)
10
+ end
11
+
12
+ private
13
+
14
+ def valid_file?
15
+ file_defaults.is_a?(Hash)
16
+ end
17
+
18
+ def base_defaults
19
+ {
20
+ reports: '',
21
+ test_classes: '',
22
+ test_rail_username: '',
23
+ test_rail_password: '',
24
+ test_rail_url: ''
25
+ }
26
+ end
27
+
28
+ def file_defaults
29
+ @file_defaults ||= if File.exist?(defaults_file_name)
30
+ YAML.safe_load(File.read(defaults_file_name))
31
+ else
32
+ {}
33
+ end
34
+ end
35
+
36
+ def defaults_file_name
37
+ '.swiftrail.yml'
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,6 @@
1
+ module Swiftrail
2
+ module Errors
3
+ class Base < StandardError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,57 @@
1
+ require 'nokogiri'
2
+ require 'swiftrail/junit/report'
3
+
4
+ module Swiftrail
5
+ module Junit
6
+ class Parser
7
+ def initialize(junit_patterns)
8
+ @junit_patterns = junit_patterns
9
+ end
10
+
11
+ def parse
12
+ all_files.map(&method(:test_suites)).flatten
13
+ end
14
+
15
+ private
16
+
17
+ attr_reader :junit_patterns
18
+
19
+ def all_files
20
+ junit_patterns.map do |junit_pattern|
21
+ Dir[junit_pattern]
22
+ end.flatten.uniq
23
+ end
24
+
25
+ def test_suites(file)
26
+ read_report(file).xpath('//testsuite').map(&method(:create_test_suite))
27
+ end
28
+
29
+ def read_report(file)
30
+ Nokogiri::XML(IO.read(file))
31
+ end
32
+
33
+ def create_test_suite(test_suite)
34
+ TestSuite.new(
35
+ test_suite[:name],
36
+ test_cases(test_suite)
37
+ )
38
+ end
39
+
40
+ def test_cases(test_suite)
41
+ test_suite.xpath('.//testcase').map do |test_case|
42
+ TestCase.new(
43
+ test_case[:classname],
44
+ test_case[:classname].split('.').last,
45
+ test_case[:name],
46
+ failures(test_case),
47
+ test_case[:time].to_f
48
+ )
49
+ end
50
+ end
51
+
52
+ def failures(test_case)
53
+ test_case.children.select { |child| child.name == 'failure' }.map { |failure| failure.content }
54
+ end
55
+ end
56
+ end
57
+ end