cucumber-zephyr 0.1.0 → 0.1.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: e57f034d52221d5c57301ce8300eafa1bd363e8f26f279e6f73251aa77f2fae3
4
- data.tar.gz: 4c67f6432fb3c64d3b20882c014cd1162d91ce38ae55518f89ce1beb9d999cb1
3
+ metadata.gz: d3a9ff7479455e0f2a23b87215b97e6485061d23163ac7e94dc168a923bb0f7a
4
+ data.tar.gz: 7dd733adb7cc1dd8cf5aa518977bfd6474ac823e01a1d81f92f98e6a9dc8761e
5
5
  SHA512:
6
- metadata.gz: f5d932b7dc370f4fce7acd4020352dd1bd783ecdf799e977e91a220c747984042f0df4a61799ed2c45120804e84a8b13e8866934943b17ebac5d1baae3b40403
7
- data.tar.gz: 477a6b8f2782d0c54d9150094c56a2b948646491db8b786b68bc42fb444d69cbaebab75a4c33a0098b044400be46db49e570553b0f5b25cc2b4bb167a16da171
6
+ metadata.gz: 6814bad1b4bc0df926173d404565df6d7a4674f1a004d714a82347e9129e601ca4d7c0f59c6569e1b790d88204704062de6c29628fc34c7cd661ea8bd87eeeb7
7
+ data.tar.gz: a4351bf8769c8ac81526a78c076e7e2bd82d641cc60e1521c161583d633c92c361ae28c090327b5b9aa7c275ce70dd9dc59aeec9d59e817e05f6f7c7ba55fcef
data/.rubocop.yml CHANGED
@@ -8,3 +8,10 @@ Style/StringLiteralsInInterpolation:
8
8
 
9
9
  Layout/LineLength:
10
10
  Max: 120
11
+
12
+ AllCops:
13
+ NewCops: disable
14
+ TargetRubyVersion: 2.3
15
+
16
+ Metrics/AbcSize:
17
+ Max: 21
data/Gemfile CHANGED
@@ -5,6 +5,8 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in cucumber-zephyr.gemspec
6
6
  gemspec
7
7
 
8
+ gem "cucumber", "~> 4.0"
8
9
  gem "rake", "~> 13.0"
9
10
  gem "rubocop", "~> 0.80"
10
- # gem "zephyr_cli"
11
+ gem "zephyr_cli"
12
+ gem "zephyr_ruby"
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # CucumberZephyr
2
2
 
3
- 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/cucumber-zephyr`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Write usage instructions here
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
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "lib/cucumber-zephyr/version"
3
+ require_relative "lib/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "cucumber-zephyr"
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CucumberZephyr
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
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.0
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-07-28 00:00:00.000000000 Z
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/cucumber-zephyr.rb
29
- - lib/cucumber-zephyr/version.rb
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:
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "zephyr/version"
4
-
5
- module CucumberZephyr
6
- class Error < StandardError; end
7
- # Your code goes here...
8
- end