gitlab_quality-test_tooling 0.2.0 → 0.2.1

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: 1826436013184c9312e5ba0bf45ed49eec2380743d81fa1afb31342559a799a2
4
- data.tar.gz: d7fa98724fcf619d807ff4c61756ff119af3ad04c6b9f21306aaab59b872bcbe
3
+ metadata.gz: db0c200678a2bb9d3eea994129fd3db411c9af0647225f451d548b02005e69e0
4
+ data.tar.gz: 356fcd2142b1f62507e9b4ff76903d21dfbee980a8a41662a2cd02255bc2831f
5
5
  SHA512:
6
- metadata.gz: 8c3bb098432bd3992ad6654c6540f75521e74648dd68c48be4b14962624ad835c199872cc1edf2d7a5173ec358ea3a629d612533853c2ad57a106c830b4c9ff6
7
- data.tar.gz: 1d5adf1e7cc98306bfc3d1477aee4310ac6e267da9ed73a26203d9cdba45dd0a8b927c4ecd49f37543a8771c661eaeaa035105393957e288a62cd82165955be6
6
+ metadata.gz: 2fceda952ea6665034e2c0fd4f55fbbadb3226b953613a9bc3cb3b2c3b0332b59f2043a1277a73749c8fc449bb0ea5a919b1cf278bf6a4ad92978ffa6e748fe5
7
+ data.tar.gz: cdca3c8f902068f205379836272146a61e361ca4dcd13d86b7f22372fb0a7549ed798c40e0419400ba7a2cffff3cacb726339557ac108c1b55e0edc71b72e308
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (0.2.0)
4
+ gitlab_quality-test_tooling (0.2.1)
5
5
  activesupport (~> 6.1)
6
6
  gitlab (~> 4.18.0)
7
7
  http (~> 5.0)
data/README.md CHANGED
@@ -1,28 +1,169 @@
1
1
  # `GitlabQuality::TestTooling`
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gitlab_quality/test_tooling`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ This gem provides test tooling that can be used by different projects or different part of the same project, mostly in CI scripts.
6
4
 
7
5
  ## Installation
8
6
 
9
- Install the gem and add to the application's Gemfile by executing:
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'gitlab_quality-test_tooling', require: false
11
+ ```
12
+
13
+ And then execute:
10
14
 
11
- $ bundle add gitlab_quality-test_tooling
15
+ ```sh
16
+ $ bundle install
17
+ ```
12
18
 
13
- If bundler is not being used to manage dependencies, install the gem by executing:
19
+ Or install it yourself as:
14
20
 
15
- $ gem install gitlab_quality-test_tooling
21
+ ```sh
22
+ $ gem install gitlab_quality-test_tooling
23
+ ```
16
24
 
17
25
  ## Usage
18
26
 
19
- TODO: Write usage instructions here
27
+ The gem provides the following executables.
28
+
29
+ ### `generate-test-session`
30
+
31
+ ```shell
32
+ Purpose: Generate test session report based on RSpec report files (JSON or JUnit XML)
33
+ Usage: exe/generate-test-session [options]
34
+ -i, --input-files FILES RSpec report files (JSON or JUnit XML)
35
+ -p, --project PROJECT Can be an integer or a group/project string
36
+ -t, --token ACCESS_TOKEN A valid access token with Reporter permission in PROJECT
37
+ --dry-run Perform a dry-run (don't create or update issues or test cases)
38
+ -v, --version Show the version
39
+ -h, --help Show the usage
40
+ ```
41
+
42
+ ### `post-to-slack`
43
+
44
+ ```shell
45
+ $ exe/post-to-slack -h
46
+ Purpose: Post a message to Slack, and optionally add a test summary table based on RSpec report files (JUnit XML)
47
+ Usage: exe/post-to-slack [options]
48
+ -w SLACK_WEBHOOK_URL, Slack webhook URL
49
+ --slack-webhook-url
50
+ -c, --channel CHANNEL Slack channel to post the message to
51
+ -m, --message MESSAGE Post message to Slack
52
+ -t FILES, Add a test summary table based on RSpec report files (JUnit XML)
53
+ --include-summary-table
54
+ -u, --username USERNAME Username to use for the Slack message
55
+ -i, --icon-emoji ICON_EMOJI Icon emoji to use for the Slack message
56
+ -v, --version Show the version
57
+ -h, --help Show the usage
58
+ ```
59
+
60
+ ### `prepare-stage-reports`
61
+
62
+ ```shell
63
+ $ exe/prepare-stage-reports -h
64
+ Purpose: Prepare separate reports for each DevOps stage from the provided RSpec report files (JUnit XML)
65
+ Usage: exe/prepare-stage-reports [options]
66
+ -j, --junit-files FILES RSpec report files (JUnit XML)
67
+ -v, --version Show the version
68
+ -h, --help Show the usage
69
+ ```
70
+
71
+ ### `relate-failure-issue`
72
+
73
+ ```shell
74
+ $ exe/relate-failure-issue -h
75
+ Purpose: Relate test failures to failure issues from RSpec report files (JSON or JUnit XML)
76
+ Usage: exe/relate-failure-issue [options]
77
+ -i, --input-files FILES RSpec report files (JSON or JUnit XML)
78
+ --max-diff-ratio DIFF_RATO Max stacktrace diff ratio for QA failure issues detection
79
+ -p, --project PROJECT Can be an integer or a group/project string
80
+ -t, --token ACCESS_TOKEN A valid access token with Reporter permission in PROJECT
81
+ --system-log-files SYSTEM_LOG_FILES
82
+ Include errors from system logs in failure issues
83
+ --dry-run Perform a dry-run (don't create or update issues)
84
+ -v, --version Show the version
85
+ -h, --help Show the usage
86
+ ```
87
+
88
+ ### `report-results`
89
+
90
+ ```shell
91
+ $ exe/report-results -h
92
+ Purpose: Report test results from RSpec report files (JSON or JUnit XML) in GitLab test cases and result issues
93
+ Usage: exe/report-results [options]
94
+ -i, --input-files FILES RSpec report files (JSON or JUnit XML)
95
+ --test-case-project TEST_CASE_PROJECT
96
+ Can be an integer or a group/project string
97
+ --results-issue-project RESULTS_ISSUE_PROJECT
98
+ Can be an integer or a group/project string
99
+ -t, --token ACCESS_TOKEN A valid access token
100
+ --dry-run Perform a dry-run (don't create or update issues or test cases)
101
+ -v, --version Show the version
102
+ -h, --help Show the usage
103
+ ```
104
+
105
+ ### `update-screenshot-paths`
106
+
107
+ ```shell
108
+ $ exe/update-screenshot-paths -h
109
+ Purpose: Update the path to screenshots to container's host from RSpec report files (JSON or JUnit XML)
110
+ Usage: exe/update-screenshot-paths [options]
111
+ -i, --input-files FILES RSpec report files (JSON or JUnit XML)
112
+ -v, --version Show the version
113
+ -h, --help Show the usage
114
+ ```
20
115
 
21
116
  ## Development
22
117
 
118
+ ### Initial setup
119
+
23
120
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
121
 
25
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
122
+ To install this gem onto your local machine, run `bundle exec rake install`.
123
+
124
+ ### Activate lefthook locally
125
+
126
+ ```shell
127
+ lefthook install
128
+ ```
129
+
130
+ ### Testing unreleased changes in merge requests
131
+
132
+ To test an unreleased change in an actual merge request, you can create a merge request that will install the unreleased version of `gitlab_quality-test_tooling`. Bundler can install gems by specifying a repository and a revision from Git.
133
+
134
+ For example, to test `gitlab_quality-test_tooling` changes from the `your-branch-name` branch in [`gitlab-org/gitlab`](https://gitlab.com/gitlab-org/gitlab), in the `Gemfile`:
135
+
136
+ ```ruby
137
+ group :development, :test, :danger do
138
+ gem 'gitlab_quality-test_tooling', '~> 3.4.3', require: false,
139
+ git: 'https://gitlab.com/gitlab-org/ruby/gems/gitlab_quality-test_tooling.git',
140
+ ref: 'your-branch-name'
141
+ end
142
+ ```
143
+
144
+ See an [example](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92580) for more details.
145
+
146
+ ## Release
147
+
148
+ [Automated gem release process](https://gitlab.com/gitlab-org/quality/pipeline-common#release-process) is used to release new version of `gitlab_quality-test_tooling` through pipelines, and this will:
149
+
150
+ - Publish the gem: https://rubygems.org/gems/gitlab_quality-test_tooling
151
+ - Add a release in the `gitlab_quality-test_tooling` project: https://gitlab.com/gitlab-org/ruby/gems/gitlab_quality-test_tooling/-/releases
152
+ - Populate the release log with the API contents. For example: https://gitlab.com/api/v4/projects/19861191/repository/changelog?version=3.4.4
153
+
154
+ ### Before release
155
+
156
+ Make sure to include a changelog entry in your commit message and read the [changelog entries section](https://docs.gitlab.com/ee/development/changelog.html).
157
+
158
+ If you forget to set the changelog entry in your commit messages, you can also edit the release notes after it's being released.
159
+
160
+ ### Steps to release
161
+
162
+ Use a `Release` merge request template and create a merge requet to update the version number in `version.rb`, and get the merge request merged by a maintainer.
163
+
164
+ This will then be packaged into a gem and pushed to [rubygems.org](https://rubygems.org) by the CI/CD.
165
+
166
+ For example: [Bump version to 3.4.3](https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/-/merge_requests/149).
26
167
 
27
168
  ## License
28
169
 
@@ -11,7 +11,7 @@ params = {}
11
11
  options = OptionParser.new do |opts|
12
12
  opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
13
13
 
14
- opts.on('-i', '--input-files FILES', String, 'Generate test session report') do |input_files|
14
+ opts.on('-i', '--input-files FILES', String, 'RSpec report files (JSON or JUnit XML)') do |input_files|
15
15
  params[:input_files] = input_files
16
16
  end
17
17
 
@@ -34,6 +34,7 @@ options = OptionParser.new do |opts|
34
34
  end
35
35
 
36
36
  opts.on_tail('-h', '--help', 'Show the usage') do
37
+ puts "Purpose: Generate test session report based on RSpec report files (JSON or JUnit XML)"
37
38
  puts opts
38
39
  exit
39
40
  end
data/exe/post-to-slack CHANGED
@@ -23,7 +23,7 @@ options = OptionParser.new do |opts|
23
23
  params[:message] = message
24
24
  end
25
25
 
26
- opts.on('-t', '--include-summary-table FILES', String, 'Create a results summary table to post to Slack') do |files|
26
+ opts.on('-t', '--include-summary-table FILES', String, 'Add a test summary table based on RSpec report files (JUnit XML)') do |files|
27
27
  params[:message] += "\n\n#{GitlabQuality::TestTooling::SummaryTable.create(input_files: files)}"
28
28
  end
29
29
 
@@ -42,6 +42,7 @@ options = OptionParser.new do |opts|
42
42
  end
43
43
 
44
44
  opts.on_tail('-h', '--help', 'Show the usage') do
45
+ puts "Purpose: Post a message to Slack, and optionally add a test summary table based on RSpec report files (JUnit XML)"
45
46
  puts opts
46
47
  exit
47
48
  end
@@ -11,8 +11,7 @@ params = {}
11
11
  options = OptionParser.new do |opts|
12
12
  opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
13
13
 
14
- opts.on('-j', '--junit-files FILES', String,
15
- 'Prepare separate reports for each Stage from the provided JUnit XML files') do |junit_files|
14
+ opts.on('-j', '--junit-files FILES', String, 'RSpec report files (JUnit XML)') do |junit_files|
16
15
  params[:junit_files] = junit_files
17
16
  end
18
17
 
@@ -23,6 +22,7 @@ options = OptionParser.new do |opts|
23
22
  end
24
23
 
25
24
  opts.on_tail('-h', '--help', 'Show the usage') do
25
+ puts "Purpose: Prepare separate reports for each DevOps stage from the provided RSpec report files (JUnit XML)"
26
26
  puts opts
27
27
  exit
28
28
  end
@@ -11,8 +11,7 @@ params = {}
11
11
  options = OptionParser.new do |opts|
12
12
  opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
13
13
 
14
- opts.on('-i', '--input-files FILES', String,
15
- 'Relate test failures to failure issues from RSpec JSON files') do |input_files|
14
+ opts.on('-i', '--input-files FILES', String, 'RSpec report files (JSON or JUnit XML)') do |input_files|
16
15
  params[:input_files] = input_files
17
16
  end
18
17
 
@@ -33,7 +32,7 @@ options = OptionParser.new do |opts|
33
32
  params[:system_logs] = system_log_files
34
33
  end
35
34
 
36
- opts.on('--dry-run', "Perform a dry-run (don't create or update issues or test cases)") do
35
+ opts.on('--dry-run', "Perform a dry-run (don't create or update issues)") do
37
36
  params[:dry_run] = true
38
37
  end
39
38
 
@@ -44,6 +43,7 @@ options = OptionParser.new do |opts|
44
43
  end
45
44
 
46
45
  opts.on_tail('-h', '--help', 'Show the usage') do
46
+ puts "Purpose: Relate test failures to failure issues from RSpec report files (JSON or JUnit XML)"
47
47
  puts opts
48
48
  exit
49
49
  end
data/exe/report-results CHANGED
@@ -11,8 +11,7 @@ params = {}
11
11
  options = OptionParser.new do |opts|
12
12
  opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
13
13
 
14
- opts.on('-i', '--input-files FILES', String,
15
- 'Report test results from JUnit or JSON files in GitLab test cases and results issues') do |input_files|
14
+ opts.on('-i', '--input-files FILES', String, 'RSpec report files (JSON or JUnit XML)') do |input_files|
16
15
  params[:input_files] = input_files
17
16
  end
18
17
 
@@ -41,6 +40,7 @@ options = OptionParser.new do |opts|
41
40
  end
42
41
 
43
42
  opts.on_tail('-h', '--help', 'Show the usage') do
43
+ puts "Purpose: Report test results from RSpec report files (JSON or JUnit XML) in GitLab test cases and result issues"
44
44
  puts opts
45
45
  exit
46
46
  end
@@ -11,9 +11,8 @@ params = {}
11
11
  options = OptionParser.new do |opts|
12
12
  opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
13
13
 
14
- opts.on('--junit-files FILES', String,
15
- "Update the path to screenshots to container's host from the provided JUnit XML files") do |_files|
16
- params[:junit_files] = junit_files
14
+ opts.on('-i', '--input-files FILES', String, 'RSpec report files (JSON or JUnit XML)') do |input_files|
15
+ params[:junit_files] = input_files
17
16
  end
18
17
 
19
18
  opts.on_tail('-v', '--version', 'Show the version') do
@@ -23,6 +22,7 @@ options = OptionParser.new do |opts|
23
22
  end
24
23
 
25
24
  opts.on_tail('-h', '--help', 'Show the usage') do
25
+ puts "Purpose: Update the path to screenshots to container's host from RSpec report files (JSON or JUnit XML)"
26
26
  puts opts
27
27
  exit
28
28
  end
@@ -5,7 +5,6 @@ require 'nokogiri'
5
5
  module GitlabQuality
6
6
  module TestTooling
7
7
  module Report
8
- # Create a new JUnit report file for each Stage, containing tests from that Stage alone
9
8
  class PrepareStageReports
10
9
  EXTRACT_STAGE_FROM_TEST_FILE_REGEX = %r{(?:api|browser_ui)/(?:[0-9]+_)?(?<stage>[_\w]+)/}i
11
10
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_quality-test_tooling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality