swiftrail 0.1.17 → 0.1.18
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 +4 -4
- data/Gemfile.lock +12 -12
- data/README.md +39 -0
- data/lib/swiftrail/quicknimble/parser.rb +26 -0
- data/lib/swiftrail/testrail/assembler.rb +14 -1
- data/lib/swiftrail/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 344334b9380d8f1077901a2901818f36d06bcb5348ec3f41377d3f7b28498136
|
4
|
+
data.tar.gz: 5e2722b3f7e33717962be3c7e35148557bb0492be43f435dc1a4758abeb9ff8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19b27fd47f8cd0ef552443c377e3ff2f0504031c471949b55d7b87a8417c58f100cda114048d3e09eca1305f2b1c7be611685a60bdcbe53248c1bbf50d542e4c
|
7
|
+
data.tar.gz: 36ccecbbb3c633c5a1c050205817a05a37995755128f19f669d1dc1f9bd9c5dd546518f96690d5beeb2d206a92f89cd56913d6c285ff9a9a1f5e7fe0134d8f7a
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
swiftrail (0.1.
|
4
|
+
swiftrail (0.1.18)
|
5
5
|
nokogiri (>= 1.10.4)
|
6
6
|
thor (~> 0.20)
|
7
7
|
|
@@ -13,19 +13,19 @@ GEM
|
|
13
13
|
nokogiri (1.10.7)
|
14
14
|
mini_portile2 (~> 2.4.0)
|
15
15
|
rake (10.5.0)
|
16
|
-
rspec (3.
|
17
|
-
rspec-core (~> 3.
|
18
|
-
rspec-expectations (~> 3.
|
19
|
-
rspec-mocks (~> 3.
|
20
|
-
rspec-core (3.
|
21
|
-
rspec-support (~> 3.
|
22
|
-
rspec-expectations (3.
|
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.
|
25
|
-
rspec-mocks (3.
|
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.
|
28
|
-
rspec-support (3.
|
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,26 @@
|
|
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 extractInformation(test_case)
|
11
|
+
extracted_cases = test_case.scan(case_regex)[0]
|
12
|
+
if !extracted_cases.nil?
|
13
|
+
case_ids = extracted_cases.split('_').reject { |c| c.empty? }
|
14
|
+
RegexMatch.new(case_ids, test_case)
|
15
|
+
else
|
16
|
+
RegexMatch.new([], test_case)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# find all occurences in string like this example: "C12345"
|
21
|
+
def case_regex
|
22
|
+
%r{_(?:_(?:C\d+)+)+__}i
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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 = extractInformation(test_case)
|
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 &&
|
data/lib/swiftrail/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.18
|
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-
|
11
|
+
date: 2020-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- lib/swiftrail/errors/error.rb
|
108
108
|
- lib/swiftrail/junit/parser.rb
|
109
109
|
- lib/swiftrail/junit/report.rb
|
110
|
+
- lib/swiftrail/quicknimble/parser.rb
|
110
111
|
- lib/swiftrail/swift/lint.rb
|
111
112
|
- lib/swiftrail/swift/parser.rb
|
112
113
|
- lib/swiftrail/swift/test.rb
|