crab 0.1.5 → 0.1.6
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.
- data/README.md +24 -6
- data/lib/crab.rb +1 -0
- data/lib/crab/commands/testcase.rb +81 -0
- data/lib/crab/rally.rb +10 -0
- data/lib/crab/testcase.rb +55 -0
- data/lib/crab/version.rb +1 -1
- metadata +4 -3
data/README.md
CHANGED
@@ -74,13 +74,32 @@ steps:
|
|
74
74
|
...
|
75
75
|
|
76
76
|
Some data about stories can also be edited straight from the command line.
|
77
|
-
In that sense, `crab` acts more like a command-line interface to Rally than a
|
78
|
-
between Rally and Cucumber, but the team thought these were *very*
|
79
|
-
features to have:
|
77
|
+
In that sense, `crab` acts more like a command-line interface to Rally than a
|
78
|
+
bridge between Rally and Cucumber, but the team thought these were *very*
|
79
|
+
convenient features to have:
|
80
|
+
|
81
|
+
$ crab create "Secure Access to Flying Fortress Controls"
|
82
|
+
US1004: Secure Access to Flying Fortress Controls (grooming)
|
80
83
|
|
81
84
|
$ crab update US1001 --name "Arms Rockets Upon Successful Boot" --state completed
|
85
|
+
US1001: Arms Rockets Upon Successful Boot (completed)
|
86
|
+
|
87
|
+
$ crab delete US1004 # not in this movie :(
|
88
|
+
Story US1004 deleted.
|
89
|
+
|
90
|
+
It is also possible to add, update and delete test cases inside Rally straight
|
91
|
+
from the command line:
|
92
|
+
|
93
|
+
$ crab testcase add US1001 "Rocket Silo Is Unlocked"
|
94
|
+
US1001/TC1501: Rocket Silo Is Unlocked (important medium automated acceptance)
|
95
|
+
|
96
|
+
$ crab testcase update TC1501 --priority critical --risk low
|
97
|
+
US1001/TC1501: Rocket Silo Is Unlocked (critical low automated acceptance)
|
98
|
+
|
99
|
+
$ crab testcase delete TC1501
|
100
|
+
Test case TC1501 deleted.
|
82
101
|
|
83
|
-
There are more switches.
|
102
|
+
There are more switches. Try `crab --help` to find out more.
|
84
103
|
|
85
104
|
i18n Support
|
86
105
|
------------
|
@@ -91,7 +110,7 @@ included:
|
|
91
110
|
$ crab show US1001 -l ja
|
92
111
|
機能: [US1001] Arms Rockets Upon Successful Boot
|
93
112
|
...
|
94
|
-
シナリオ: [
|
113
|
+
シナリオ: [TC1501] Rocket Silo Is Unlocked
|
95
114
|
Given a silo where the rockets are stored
|
96
115
|
...
|
97
116
|
|
@@ -125,7 +144,6 @@ To do
|
|
125
144
|
|
126
145
|
- Add a config command + .crab/config file to hold settings like project, etc
|
127
146
|
- Add a `push` subcommand which parses a Cucumber feature and adds or updates it in Rally
|
128
|
-
- Add a way to create, edit and delete test cases / scenarios from the command line
|
129
147
|
- `pull` is not very smart and could detect feature files being moved from one dir to another
|
130
148
|
- Recursively look for a `.crab` directory like Git does with `.git`
|
131
149
|
- Encrypt password in generated `~/.crab/credentials`
|
data/lib/crab.rb
CHANGED
@@ -5,16 +5,97 @@ module Crab::Commands
|
|
5
5
|
def initialize(global_opts, args)
|
6
6
|
@global_opts = global_opts
|
7
7
|
@args = args
|
8
|
+
@rally = Crab::Rally.new
|
9
|
+
|
8
10
|
@cmd_opts = Trollop::options do
|
9
11
|
banner "crab testcase: manage test cases in a story (add, update, delete)
|
10
12
|
|
11
13
|
Usage: crab [options] testcase add story name [options]
|
12
14
|
crab [options] testcase update testcase [options]
|
13
15
|
crab [options] testcase delete testcase [options]"
|
16
|
+
|
17
|
+
stop_on %w{add update delete}
|
14
18
|
end
|
15
19
|
end
|
16
20
|
|
17
21
|
def run
|
22
|
+
sub = ARGV.shift
|
23
|
+
case sub
|
24
|
+
when "add"
|
25
|
+
opts = Trollop::options do
|
26
|
+
banner "crab testcase add: add a test case to a story in Rally"
|
27
|
+
opt :priority, "Priority (one of: #{Crab::TestCase::PRIORITIES.join(" ")}", :default => "important", :short => '-p'
|
28
|
+
opt :risk, "Risk (one of: #{Crab::TestCase::RISKS.join(" ")})", :default => "medium", :short => '-r'
|
29
|
+
opt :method, "Method (one of: #{Crab::TestCase::METHODS.join(" ")})", :default => "automated", :short => '-m'
|
30
|
+
opt :type, "Type (one of: #{Crab::TestCase::TYPES.join(" ")})", :default => "acceptance", :short => '-t'
|
31
|
+
opt :pre, "Pre-conditions", :default => "N/A"
|
32
|
+
opt :post, "Post-conditions", :default => "N/A"
|
33
|
+
opt :desc, "Description", :default => "N/A", :short => '-d'
|
34
|
+
end
|
35
|
+
|
36
|
+
story_id = ARGV.shift
|
37
|
+
name = ARGV.join(" ")
|
38
|
+
add(story_id, name, opts)
|
39
|
+
|
40
|
+
when "update"
|
41
|
+
opts = Trollop::options do
|
42
|
+
banner "crab testcase update: update a test case in Rally"
|
43
|
+
opt :priority, "Priority (one of: #{Crab::TestCase::PRIORITIES.join(" ")}", :default => "important", :short => '-p'
|
44
|
+
opt :risk, "Risk (one of: #{Crab::TestCase::RISKS.join(" ")})", :default => "medium", :short => '-r'
|
45
|
+
opt :method, "Method (one of: #{Crab::TestCase::METHODS.join(" ")})", :default => "automated", :short => '-m'
|
46
|
+
opt :type, "Type (one of: #{Crab::TestCase::TYPES.join(" ")})", :default => "acceptance", :short => '-t'
|
47
|
+
opt :pre, "Pre-conditions", :default => "N/A"
|
48
|
+
opt :post, "Post-conditions", :default => "N/A"
|
49
|
+
opt :desc, "Description", :default => "N/A", :short => '-d'
|
50
|
+
end
|
51
|
+
|
52
|
+
tc_id = ARGV.shift
|
53
|
+
update(tc_id, opts)
|
54
|
+
|
55
|
+
when "delete"
|
56
|
+
Trollop::options do
|
57
|
+
banner "crab testcase delete: delete a test case in Rally"
|
58
|
+
end
|
59
|
+
|
60
|
+
tc_id = ARGV.shift
|
61
|
+
delete(tc_id)
|
62
|
+
|
63
|
+
else
|
64
|
+
Trollop::die "Unknown subcommand#{' ' + sub.inspect if sub}"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def add(story_id, name, opts)
|
69
|
+
@rally.connect
|
70
|
+
tc = @rally.create_test_case(story_id, name, sanitize_options(opts))
|
71
|
+
|
72
|
+
puts "#{tc.story.formatted_id}/#{tc.formatted_id}: #{tc.name} (#{tc.tags.join(" ")})"
|
73
|
+
end
|
74
|
+
|
75
|
+
def update(tc_id, opts)
|
76
|
+
@rally.connect
|
77
|
+
tc = @rally.find_test_case(tc_id)
|
78
|
+
tc.update(sanitize_options(opts))
|
79
|
+
puts "#{tc.story.formatted_id}/#{tc.formatted_id}: #{tc.name} (#{tc.tags.join(" ")}"
|
80
|
+
end
|
81
|
+
|
82
|
+
def delete(tc_id)
|
83
|
+
@rally.connect
|
84
|
+
tc = @rally.find_test_case(tc_id)
|
85
|
+
tc.delete
|
86
|
+
puts "Test case #{tc_id} deleted."
|
87
|
+
end
|
88
|
+
|
89
|
+
def sanitize_options(opts, creating=true)
|
90
|
+
result = {}
|
91
|
+
result[:priority] = opts[:priority].capitalize if creating || opts[:priority_given]
|
92
|
+
result[:risk] = opts[:risk].capitalize if creating || opts[:risk_given]
|
93
|
+
result[:method] = opts[:method].capitalize if creating || opts[:method_given]
|
94
|
+
result[:type] = opts[:type].capitalize if creating || opts[:type_given]
|
95
|
+
result[:pre_conditions] = opts[:pre] if creating || opts[:pre_given]
|
96
|
+
result[:post_conditions] = opts[:post] if creating || opts[:post_given]
|
97
|
+
result[:description] = opts[:desc] if creating || opts[:desc_given]
|
98
|
+
result
|
18
99
|
end
|
19
100
|
end
|
20
101
|
end
|
data/lib/crab/rally.rb
CHANGED
@@ -49,5 +49,15 @@ module Crab
|
|
49
49
|
def create_story(opts)
|
50
50
|
Crab::Story.new @rally.create(:hierarchical_requirement, opts)
|
51
51
|
end
|
52
|
+
|
53
|
+
def create_test_case(story_id, name, opts)
|
54
|
+
story = find_story_with_id story_id
|
55
|
+
Crab::TestCase.new @rally.create(:test_case, {:name => name, :work_product => story.rally_object, :project => story.rally_object.project}.merge(opts))
|
56
|
+
end
|
57
|
+
|
58
|
+
def find_test_case(tc_id)
|
59
|
+
Crab::TestCase.new @rally.find(:test_case) { equal :formatted_i_d, tc_id }.first
|
60
|
+
end
|
61
|
+
|
52
62
|
end
|
53
63
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Crab
|
2
|
+
|
3
|
+
class TestCase
|
4
|
+
|
5
|
+
PRIORITIES = %w{useful important critical}
|
6
|
+
RISKS = %w{low medium high}
|
7
|
+
METHODS = %w{automated manual}
|
8
|
+
TYPES = %w{acceptance functional non-functional performance regression usability}
|
9
|
+
|
10
|
+
def initialize(rally_test_case)
|
11
|
+
@rally_test_case = rally_test_case
|
12
|
+
end
|
13
|
+
|
14
|
+
def formatted_id
|
15
|
+
@rally_test_case.formatted_i_d
|
16
|
+
end
|
17
|
+
|
18
|
+
def name
|
19
|
+
@rally_test_case.name
|
20
|
+
end
|
21
|
+
|
22
|
+
def tags
|
23
|
+
[priority, risk, test_method, test_type].map &:parameterize
|
24
|
+
end
|
25
|
+
|
26
|
+
def priority
|
27
|
+
@rally_test_case.priority
|
28
|
+
end
|
29
|
+
|
30
|
+
def risk
|
31
|
+
@rally_test_case.risk
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_method
|
35
|
+
@rally_test_case.elements[:method]
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_type
|
39
|
+
@rally_test_case.elements[:type]
|
40
|
+
end
|
41
|
+
|
42
|
+
def story
|
43
|
+
Crab::Story.new @rally_test_case.work_product
|
44
|
+
end
|
45
|
+
|
46
|
+
def delete
|
47
|
+
@rally_test_case.delete
|
48
|
+
end
|
49
|
+
|
50
|
+
def update(options)
|
51
|
+
@rally_test_case.update options
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
data/lib/crab/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Carlos Villela
|
@@ -187,6 +187,7 @@ files:
|
|
187
187
|
- lib/crab/rally.rb
|
188
188
|
- lib/crab/scenario.rb
|
189
189
|
- lib/crab/story.rb
|
190
|
+
- lib/crab/testcase.rb
|
190
191
|
- lib/crab/utilities.rb
|
191
192
|
- lib/crab/version.rb
|
192
193
|
has_rdoc: true
|