swiftrail 0.1.17 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a678a2541859e84a128663760ea14eca235e8937fc32e53d859432bbab1a126
4
- data.tar.gz: 1cacbf8751bd4ffffa614a95e79133bda45355abef8f23417b4861245c0622f3
3
+ metadata.gz: 8afdc799a53575a3f00847bca46824f5c249fb3029713031ae3b31eb003fccdc
4
+ data.tar.gz: c2e9369bea6607a6bc6dd24ebd0c1dc095b8263cd5defe3df8a259df96fcfd7e
5
5
  SHA512:
6
- metadata.gz: 408a74b5894568091bd65e9908c33c7fc5a373d1e87da9c1bede34340c8139123698bf719f13ea6879c71aabc5bc0cafc4e144a17385de501a4fc6346ec4b736
7
- data.tar.gz: 42a3ba703525ec4285d5356a82adb94a637548edf53110cb271717266d69fc6b68fe5e524b2a84d534cd30cb231cf8d107ce921dcc0085157d5919f10a8fe74c
6
+ metadata.gz: 794b5eb3428e8b56e3c7a108a2d182fabbab2f0bc3fff839b21f8544ff2604b446ea7f6d1648758592f9be1e5af5b344393a74a8b3185b591bb3a23e983a5458
7
+ data.tar.gz: 04edcd28f4739bd1be4945dcf42a7505aa656b14bd67cee4a4b6b2af9c5b38c021bb9bb008984f75f447ff5170ea4c1e4a4222293f95557b0972ce2887615c4d
@@ -0,0 +1,8 @@
1
+ example_id | status | run_time |
2
+ ----------------------------------------- | ------ | --------------- |
3
+ ./spec/swiftrail_assembler_spec.rb[1:1:1] | passed | 0.0001 seconds |
4
+ ./spec/swiftrail_spec.rb[1:1:1:1] | passed | 0.00138 seconds |
5
+ ./spec/swiftrail_spec.rb[1:1:1:2] | passed | 0.00008 seconds |
6
+ ./spec/swiftrail_spec.rb[1:1:1:3] | passed | 0.00007 seconds |
7
+ ./spec/swiftrail_spec.rb[1:1:1:4] | passed | 0.00007 seconds |
8
+ ./spec/swiftrail_spec.rb[1:1:1:5] | passed | 0.00006 seconds |
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swiftrail (0.1.17)
4
+ swiftrail (0.1.21)
5
5
  nokogiri (>= 1.10.4)
6
6
  thor (~> 0.20)
7
7
 
@@ -10,22 +10,22 @@ GEM
10
10
  specs:
11
11
  diff-lcs (1.3)
12
12
  mini_portile2 (2.4.0)
13
- nokogiri (1.10.7)
13
+ nokogiri (1.10.8)
14
14
  mini_portile2 (~> 2.4.0)
15
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.2)
21
- rspec-support (~> 3.8.0)
22
- rspec-expectations (3.8.4)
16
+ rspec (3.9.0)
17
+ rspec-core (~> 3.9.0)
18
+ rspec-expectations (~> 3.9.0)
19
+ rspec-mocks (~> 3.9.0)
20
+ rspec-core (3.9.1)
21
+ rspec-support (~> 3.9.1)
22
+ rspec-expectations (3.9.0)
23
23
  diff-lcs (>= 1.2.0, < 2.0)
24
- rspec-support (~> 3.8.0)
25
- rspec-mocks (3.8.1)
24
+ rspec-support (~> 3.9.0)
25
+ rspec-mocks (3.9.1)
26
26
  diff-lcs (>= 1.2.0, < 2.0)
27
- rspec-support (~> 3.8.0)
28
- rspec-support (3.8.2)
27
+ rspec-support (~> 3.9.0)
28
+ rspec-support (3.9.2)
29
29
  thor (0.20.3)
30
30
 
31
31
  PLATFORMS
data/README.md CHANGED
@@ -62,6 +62,45 @@ class MyOtherTests: XCTestCase {
62
62
  }
63
63
  }
64
64
  ```
65
+
66
+ #### QuickNimble support
67
+ If Quick/Nimble is used for generating tests, the above examples can't be used.
68
+
69
+ In order for SwiftRail to detect which tests are linked to which cases ids, you need to add this custom context in your project:
70
+
71
+ ```swift
72
+ public func testRail(_ ids: Int..., flags: FilterFlags = [:], closure: () -> Void) {
73
+ let formattedTestrailCases = ids
74
+ .map({ "C\($0)" })
75
+ .joined(separator: " ")
76
+ context(formattedTestrailCases, flags: flags, closure: closure)
77
+ }
78
+ ```
79
+
80
+ and then you can use it this way in your tests:
81
+
82
+ ```swift
83
+ class MyControllerTests: QuickSpec {
84
+ override func spec() {
85
+ describe("MyControllerTests") {
86
+ testRail(12345, 22222, 33333) { // Add this new custom context
87
+ context("when creating it") {
88
+ let sut = "short string"
89
+ it("no output value") {
90
+ expect(sut).to(equal("short string")
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+
97
+ ```
98
+
99
+ It will generate test with the following name:
100
+ `MyControllerTests__C12345_C22222_C33333__when_creating_it__no_output_value`
101
+
102
+ And this test will be picked up by swiftrail and report it to testrail for the linked testrail cases!
103
+
65
104
  ### Report
66
105
 
67
106
  When running report you additionaly have to pass location of the test_reports, and if you want strict mode
@@ -0,0 +1,25 @@
1
+ require 'swiftrail/testrail/intermediate_result'
2
+
3
+ module Swiftrail
4
+ module QuickNimble
5
+ class Parser
6
+
7
+ RegexMatch = Struct.new(:case_ids, :test_name)
8
+
9
+ # return RegexMatch result
10
+ def extract_information(test_name)
11
+ RegexMatch.new(cases(test_name), test_name)
12
+ end
13
+
14
+ # find all occurences in string like this example: "C12345"
15
+ def cases(test_name)
16
+ test_name
17
+ .split('__')
18
+ .map { |group| group.split('_') }
19
+ .select { |elements| elements.all? { |case_id| case_id =~ /C\d+/i } }
20
+ .flatten
21
+ .map { |case_id| case_id[1..-1] }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -20,8 +20,8 @@ module Swiftrail
20
20
  response = conn.request(post_request(publish_result_path, results))
21
21
 
22
22
  raise Error::InvalidRequest.new(response) if response.code == '400'
23
- raise Error::NoPermission(response) if response.code == '403'
24
- raise Error::Unknown(response), response.code unless response.code == '200'
23
+ raise Error::NoPermission.new(response) if response.code == '403'
24
+ raise Error::Unknown.new(response), response.code unless response.code == '200'
25
25
 
26
26
  true
27
27
  end
@@ -1,6 +1,7 @@
1
1
  require 'swiftrail/testrail/errors'
2
2
  require 'swiftrail/testrail/api/test_case_result'
3
3
  require 'swiftrail/testrail/intermediate_result'
4
+ require 'swiftrail/quicknimble/parser'
4
5
 
5
6
  module Swiftrail
6
7
  module Testrail
@@ -28,7 +29,7 @@ module Swiftrail
28
29
  test_suite.test_cases.map do |test_case|
29
30
  swift_test = swift_test_for(test_case)
30
31
  if swift_test.nil?
31
- []
32
+ search_cases_ids(test_case)
32
33
  else
33
34
  swift_test.case_ids.map do |case_id|
34
35
  IntermediateResult.new(swift_test.file_name, swift_test.class_name, swift_test.test_name, test_case.success?, test_case.duration, test_case.failures, case_id)
@@ -37,6 +38,18 @@ module Swiftrail
37
38
  end
38
39
  end
39
40
 
41
+ # lookup case ids in test_case name
42
+ def search_cases_ids(test_case)
43
+ result = QuickNimble::Parser.new().extract_information(test_case.test_name)
44
+ if result.case_ids.empty?
45
+ []
46
+ else
47
+ result.case_ids.map do |case_id|
48
+ IntermediateResult.new(result.test_name, result.test_name, result.test_name, test_case.success?, test_case.duration, test_case.failures, case_id)
49
+ end
50
+ end
51
+ end
52
+
40
53
  def swift_test_for(junit_test_case)
41
54
  tests = swift_tests.select do |test|
42
55
  test.class_name == junit_test_case.class_name &&
@@ -1,3 +1,3 @@
1
1
  module Swiftrail
2
- VERSION = '0.1.17'.freeze
2
+ VERSION = '0.1.22'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swiftrail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Slavko Krucaj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-09 00:00:00.000000000 Z
11
+ date: 2020-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -90,6 +90,7 @@ extra_rdoc_files: []
90
90
  files:
91
91
  - ".gitignore"
92
92
  - ".rspec"
93
+ - ".rspec_status"
93
94
  - ".rubocop.yml"
94
95
  - ".ruby-version"
95
96
  - ".travis.yml"
@@ -107,6 +108,7 @@ files:
107
108
  - lib/swiftrail/errors/error.rb
108
109
  - lib/swiftrail/junit/parser.rb
109
110
  - lib/swiftrail/junit/report.rb
111
+ - lib/swiftrail/quicknimble/parser.rb
110
112
  - lib/swiftrail/swift/lint.rb
111
113
  - lib/swiftrail/swift/parser.rb
112
114
  - lib/swiftrail/swift/test.rb