cucumber-zephyr 0.1.0 → 0.1.1
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/.rubocop.yml +7 -0
- data/Gemfile +3 -1
- data/README.md +49 -4
- data/cucumber-zephyr-0.1.0.gem +0 -0
- data/cucumber-zephyr.gemspec +1 -1
- data/lib/cucumber_zephyr.rb +55 -0
- data/lib/{cucumber-zephyr/version.rb → version.rb} +1 -1
- metadata +5 -4
- data/lib/cucumber-zephyr.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3a9ff7479455e0f2a23b87215b97e6485061d23163ac7e94dc168a923bb0f7a
|
4
|
+
data.tar.gz: 7dd733adb7cc1dd8cf5aa518977bfd6474ac823e01a1d81f92f98e6a9dc8761e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6814bad1b4bc0df926173d404565df6d7a4674f1a004d714a82347e9129e601ca4d7c0f59c6569e1b790d88204704062de6c29628fc34c7cd661ea8bd87eeeb7
|
7
|
+
data.tar.gz: a4351bf8769c8ac81526a78c076e7e2bd82d641cc60e1521c161583d633c92c361ae28c090327b5b9aa7c275ce70dd9dc59aeec9d59e817e05f6f7c7ba55fcef
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# CucumberZephyr
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
This is the custom cucumber formatter.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -20,9 +18,56 @@ Or install it yourself as:
|
|
20
18
|
|
21
19
|
$ gem install cucumber-zephyr
|
22
20
|
|
21
|
+
### Important Note:
|
22
|
+
You will need to set your zephyr API access token in your environment i.e.
|
23
|
+
|
24
|
+
$ $ZEPHYR_API_KEY='YOUR-API-KEY'
|
25
|
+
|
23
26
|
## Usage
|
24
27
|
|
25
|
-
|
28
|
+
To use this customer cucumber formatter you will either need to register this formatter in either your cucumber.yml file or via command line.
|
29
|
+
|
30
|
+
To register via your formatter simple add this line to your default settings:
|
31
|
+
```yml
|
32
|
+
default: --format zephyr
|
33
|
+
```
|
34
|
+
|
35
|
+
To register via command line:
|
36
|
+
```
|
37
|
+
cucumber --format zephyr
|
38
|
+
```
|
39
|
+
|
40
|
+
### Example
|
41
|
+
Assuming our example cucumber framework has the following structure:
|
42
|
+
```
|
43
|
+
my_cucumber_project/
|
44
|
+
├── features/
|
45
|
+
│ ├── step_definitions/
|
46
|
+
│ │ └── guess_the_word_steps.rb
|
47
|
+
│ ├── support/
|
48
|
+
│ │ └── env.rb
|
49
|
+
│ └── guess_the_word.feature
|
50
|
+
├── Gemfile
|
51
|
+
└── Gemfile.lock
|
52
|
+
```
|
53
|
+
|
54
|
+
Here is an example implementation of the zephyr custom formatter. We start with an example feature file with zephyr test fase tags added to the scenario we want:
|
55
|
+
```gherkin
|
56
|
+
# my_cucumber_project/features/guess_the_word.feature
|
57
|
+
|
58
|
+
Feature: Guess the word
|
59
|
+
|
60
|
+
@SBX-1234 # @{zephyr_project_id}-1234
|
61
|
+
Scenario: Maker starts a game
|
62
|
+
When the Maker starts a game
|
63
|
+
Then the Maker waits for a Breaker to join
|
64
|
+
```
|
65
|
+
|
66
|
+
Important Note: Make sure to import this gem into your `env.rb` file.
|
67
|
+
|
68
|
+
Then, run the example feature file:
|
69
|
+
|
70
|
+
$ cucumber features/guess_the_word.feature --format zephyr --results_format junit --project_id SBX --file path/to/results/file --auto_close_cycle --auto_create_test_cases --name 'New Automated Test Cycle' --description 'This is the description of my new automated test cycle'
|
26
71
|
|
27
72
|
## Development
|
28
73
|
|
Binary file
|
data/cucumber-zephyr.gemspec
CHANGED
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "cucumber/formatter/console"
|
4
|
+
require "cucumber/formatter/io"
|
5
|
+
require "cucumber/formatter/pretty"
|
6
|
+
require "cucumber/cli/options"
|
7
|
+
require "cucumber/formatter/legacy_api/adapter"
|
8
|
+
require "zephyr_ruby"
|
9
|
+
|
10
|
+
@zephyr_client = ZephyrRuby::Client.new(ENV["ZEPHYR_API_KEY"])
|
11
|
+
|
12
|
+
module Cucumber
|
13
|
+
module Formatter
|
14
|
+
# This class is the formatter for the Zephyr plugin
|
15
|
+
class CucumberZephyr
|
16
|
+
include console
|
17
|
+
include Io
|
18
|
+
|
19
|
+
def initialize(config)
|
20
|
+
@io = Cucumber::Formatter::Io.new(config.out_stream, config.default_path, "upload-to-zephyr")
|
21
|
+
@project_id = config.options[:project_id]
|
22
|
+
@results_format = config.options[:results_format]
|
23
|
+
@path_to_file = config.options[:path_to_file]
|
24
|
+
@auto_close_cycle = config.options[:auto_close_cycle] ? true : false
|
25
|
+
@auto_create_test_cases = config.options[:auto_create_test_cases] ? true : false
|
26
|
+
@name = config.options[:name]
|
27
|
+
@description = config.options[:description]
|
28
|
+
|
29
|
+
at_exit { upload_results }
|
30
|
+
end
|
31
|
+
|
32
|
+
def before_feature(feature)
|
33
|
+
@current_feature = feature
|
34
|
+
end
|
35
|
+
|
36
|
+
def before_scenario(scenario)
|
37
|
+
@current_scenario = scenario
|
38
|
+
end
|
39
|
+
|
40
|
+
def upload_results
|
41
|
+
system("zephyr_cli test_cycles " \
|
42
|
+
"--#{@results_format} " \
|
43
|
+
"--project_id=#{@project_id} " \
|
44
|
+
"--file=#{@path_to_file} " \
|
45
|
+
"--auto_close_cycle=#{@auto_close_cycle} " \
|
46
|
+
"--auto_create_test_cases=#{@auto_create_test_cases}" \
|
47
|
+
"--name=#{@name} " \
|
48
|
+
"--description=#{@description}")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Register the formatter
|
55
|
+
Cucumber::Cli::Options::FORMATTERS["zephyr"] = Cucumber::Formatter::CucumberZephyr
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-zephyr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Davis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Cucumber formatter for Zephyr
|
14
14
|
email:
|
@@ -24,9 +24,10 @@ files:
|
|
24
24
|
- Rakefile
|
25
25
|
- bin/console
|
26
26
|
- bin/setup
|
27
|
+
- cucumber-zephyr-0.1.0.gem
|
27
28
|
- cucumber-zephyr.gemspec
|
28
|
-
- lib/
|
29
|
-
- lib/
|
29
|
+
- lib/cucumber_zephyr.rb
|
30
|
+
- lib/version.rb
|
30
31
|
homepage: https://github.com/cdavis-personal/cucumber-zephyr
|
31
32
|
licenses: []
|
32
33
|
metadata:
|