zephyr_cli 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d235f2f31b01aec14489f13000096529c298e779053339dc8e6f32a26acd9f3
4
- data.tar.gz: fe2aaaed9d9f4c15f145fcba25519558c34481f27a80515fda5b436d23f0c7be
3
+ metadata.gz: a3c4194d263d8837a099c4307fd535c20b2423d1f170540e9bef95de9eef911f
4
+ data.tar.gz: 611479b3ca37be02b25e2438e7b5a5ba3562ed6ca5bc99f6a3d6edddeb3c2a69
5
5
  SHA512:
6
- metadata.gz: f25848195ce2ecbd577d87fe45c7ee5524e73f46b30fb0c1bd5775052ed8768ba9c11c1cbef53ddaa4eaafd28f5bab5e0c933bd908fe261a01464fdc5102406e
7
- data.tar.gz: 28832cc18969f149a87d6c888ea6016e00f79422b42b51b3634484da4608d37f9b24e1e396aee1f3f234180212746921d4626eeaed2f832fa783f5bc95227783
6
+ metadata.gz: 129e0a9dcd71d6fd5f5122604ec210386780e5128c01d5542c8c85c9a1bd1962b9bbf8dc82a7d3f2742e32349baa840856dc4194dbc0d54d24e7404451c7aff4
7
+ data.tar.gz: dd675f021111e9c1f1caa32086dc978160a9b5c0f8ff2794811343c9a813bb09f264c36d44c2a9f5093e1df516c751e660a6e35bf5d1822c681a2c9ba7d95f64
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /config
data/.rubocop.yml CHANGED
@@ -8,3 +8,12 @@ Style/StringLiteralsInInterpolation:
8
8
 
9
9
  Layout/LineLength:
10
10
  Max: 120
11
+
12
+ Metrics/ParameterLists:
13
+ Max: 10
14
+
15
+ AllCops:
16
+ SuggestExtensions: false
17
+ TargetRubyVersion: 2.3
18
+ NewCops: disable
19
+
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
- gem 'rake', '~> 13.0'
6
- gem 'rubocop', '~> 0.80'
7
- gem 'thor'
8
- gem 'zephyr_ruby'
5
+ gem "rake", "~> 13.0"
6
+ gem "rubocop", "~> 0.80"
7
+ gem "thor"
8
+ gem "zephyr_ruby"
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # ZephyrCli
1
+ # ZephyrCLI
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/zephyr_cli`. 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
+ The handy CLI for managing all your zephyr related testing resources.
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,7 +20,7 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ 🚧 In progress.
26
24
 
27
25
  ## Development
28
26
 
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # CLIHelpers module to share common methods among the CLI classes
4
+ module CLIHelpers
5
+ def generate_automations_payload(project_id, file, _auto_close_cycle, name, description,
6
+ auto_create_test_cases: false)
7
+ auto_create_test_cases = true if auto_create_test_cases
8
+
9
+ {
10
+ projectKey: project_id,
11
+ autoCreateTestCases: auto_create_test_cases,
12
+ file: file,
13
+ testCycle: {
14
+ name: name,
15
+ description: description
16
+ }
17
+ }
18
+ end
19
+
20
+ def generate_test_cycle_payload(name, description, start_date, end_date, project_id)
21
+ {
22
+ name: name,
23
+ description: description,
24
+ plannedStartDate: start_date,
25
+ plannedEndDate: end_date,
26
+ projectId: project_id
27
+ }
28
+ end
29
+ end
@@ -1,8 +1,51 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Subcommand for creating and updating test cycles as well as uploading results in junit and cucumber format
3
4
  class TestCycles < Thor
4
- desc "hello NAME", "say hello to NAME"
5
- def hello(name)
6
- puts "Hello #{name}"
5
+ desc "upload_junit_results", "Upload test results in junit format"
6
+ method_option :project_id, type: :numeric, required: true
7
+ method_option :file, type: :string, required: true
8
+ method_option :name, type: :string, required: true
9
+ method_option :description, type: :string, required: false
10
+ method_option :auto_create_test_cases, type: :boolean, required: false
11
+ def upload_junit_results(project_id, file, auto_close_cycle, name, description, auto_create_test_cases)
12
+ payload = generate_automations_payload(project_id, file, auto_close_cycle, name, description,
13
+ auto_create_test_cases)
14
+ @zephyr_client.create_automation_junit(payload)
15
+ end
16
+
17
+ desc "upload_cucumber_results", "Upload test results in cucumber format"
18
+ method_option :project_id, type: :numeric, required: true
19
+ method_option :file, type: :string, required: true
20
+ method_option :name, type: :string, required: true
21
+ method_option :description, type: :string, required: false
22
+ method_option :auto_create_test_cases, type: :boolean, required: false
23
+ def upload_cucumber_results(_test_cycle_id, _cucumber_format)
24
+ payload = generate_automations_payload(project_id, file, auto_close_cycle, name, description,
25
+ auto_create_test_cases)
26
+ @zephyr_client.create_automation_cucumber(payload)
27
+ end
28
+
29
+ desc "create", "Create test cycle"
30
+ method_option :project_id, type: :numeric, required: true
31
+ method_option :name, type: :string, required: true
32
+ method_option :description, type: :string, required: true
33
+ method_option :start_date, type: :string, required: true
34
+ method_option :end_date, type: :string, required: true
35
+ def create(name, description, start_date, end_date, project_id)
36
+ payload = generate_test_cycle_payload(name, description, start_date, end_date, project_id)
37
+ @zephyr_client.create_test_cycle(payload)
38
+ end
39
+
40
+ desc "update", "Update test cycle"
41
+ method_option :project_id, type: :numeric, required: true
42
+ method_option :test_cycle_id, type: :numeric, required: true
43
+ method_option :name, type: :string, required: true
44
+ method_option :description, type: :string, required: true
45
+ method_option :start_date, type: :string, required: true
46
+ method_option :end_date, type: :string, required: true
47
+ def update(_test_cycle_id, name, description, start_date, end_date, project_id)
48
+ payload = generate_test_cycle_payload(name, description, start_date, end_date, project_id)
49
+ @zephyr_client.update_test_cycle(payload)
7
50
  end
8
51
  end
@@ -1,8 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Subcommand for creating and updating test plans
3
4
  class TestPlans < Thor
4
- desc "hello NAME", "say hello to NAME"
5
- def hello(name)
6
- puts "Hello #{name}"
5
+ desc "create", "Create test plan"
6
+ method_option :name, type: :string, required: true
7
+ method_option :description, type: :string, required: true
8
+ method_option :start_date, type: :string, required: true
9
+ method_option :end_date, type: :string, required: true
10
+ method_option :project_id, type: :numeric, required: true
11
+ def create_test_plan(name, description, start_date, end_date, project_id)
12
+ # TODO: Implement logic for creating test plan
13
+ end
14
+
15
+ desc "update", "Update test plan"
16
+ method_option :test_plan_id, type: :numeric, required: true
17
+ method_option :name, type: :string, required: true
18
+ method_option :description, type: :string, required: true
19
+ method_option :start_date, type: :string, required: true
20
+ method_option :end_date, type: :string, required: true
21
+ method_option :project_id, type: :numeric, required: true
22
+ def update_test_plan(test_plan_id, name, description, start_date, end_date, project_id)
23
+ # TODO: Implement logic for updating test plan
7
24
  end
8
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module ZephyrCli
4
- VERSION = "0.1.0"
3
+ module ZephyrCLI
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/zephyr_cli.rb CHANGED
@@ -1,14 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "zephyr_ruby"
4
+ require "thor"
5
+ require "nokogiri"
3
6
  require_relative "zephyr_cli/version"
7
+ require_relative "zephyr_cli/test_cycles"
8
+ require_relative "zephyr_cli/test_plans"
9
+ require_relative "zephyr_cli/helpers/cli_helpers"
4
10
 
5
- module ZephyrCli
6
- class Error < StandardError; end
11
+ @zephyr_client = ZephyrRuby::Client.new(ENV["ZEPHYR_API_KEY"])
7
12
 
8
- class MyCLI < Thor
9
- desc "hello NAME", "say hello to NAME"
10
- def hello(name)
11
- puts "Hello #{name}"
12
- end
13
- end
13
+ # CLI for creating test cycles and test plans in zephyr
14
+ class CLI < Thor
15
+ desc "test_cycles", "Test cycles commands"
16
+ subcommand "test_cycles", TestCycles
17
+
18
+ desc "test_plans", "Test plans commands"
19
+ subcommand "test_plans", TestPlans
14
20
  end
21
+
22
+ CLI.start(ARGV)
Binary file
data/zephyr_cli.gemspec CHANGED
@@ -4,7 +4,7 @@ require_relative "lib/zephyr_cli/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "zephyr_cli"
7
- spec.version = ZephyrCli::VERSION
7
+ spec.version = ZephyrCLI::VERSION
8
8
  spec.authors = ["Chris Davis"]
9
9
 
10
10
  spec.summary = "Zephyr CLI"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zephyr_cli
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-26 00:00:00.000000000 Z
11
+ date: 2024-08-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Zephyr CLI
14
14
  email:
@@ -26,11 +26,11 @@ files:
26
26
  - bin/console
27
27
  - bin/setup
28
28
  - lib/zephyr_cli.rb
29
- - lib/zephyr_cli/helpers/zephyr_client.rb
30
- - lib/zephyr_cli/test_cases.rb
29
+ - lib/zephyr_cli/helpers/cli_helpers.rb
31
30
  - lib/zephyr_cli/test_cycles.rb
32
31
  - lib/zephyr_cli/test_plans.rb
33
32
  - lib/zephyr_cli/version.rb
33
+ - zephyr_cli-0.1.0.gem
34
34
  - zephyr_cli.gemspec
35
35
  homepage: https://github.com/cdavis-personal/zephyr_cli
36
36
  licenses: []
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "zephyr_ruby"
4
-
5
- module ZephyrClient
6
- @client = ZephyrRuby::Client.new("YOUR_API_KEY")
7
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class TestCases < Thor
4
- desc "hello NAME", "say hello to NAME"
5
- def hello(name)
6
- puts "Hello #{name}"
7
- end
8
- end