crab 0.2.10 → 0.2.11

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 CHANGED
@@ -52,6 +52,10 @@ Thankfully, that part is easy:
52
52
  US1002: Launches Rockets Upon Command from Evil Mastermind
53
53
 
54
54
  $ crab story show US1001
55
+ # language: en
56
+ # state: grooming
57
+ # fetched: 2011-10-04T13:32:35-03:00
58
+ # revision: 17, by cv@lixo.org
55
59
  Feature: [US1001] Arms Rockets After Boot
56
60
 
57
61
  In order to gain bargaining power with Super Hero
@@ -60,11 +64,16 @@ Thankfully, that part is easy:
60
64
 
61
65
  ...
62
66
 
67
+ Note the comments at the top of the file: language is relevant to
68
+ Cucumber, but all others are only to help keeping track of revisions
69
+ and changes.
70
+
63
71
  If there are any test cases associated with that story, they get converted
64
72
  into Cucumber scenarios:
65
73
 
66
74
  $ crab story show US1001
67
75
  ...
76
+ # revision: 6, by cv@lixo.org
68
77
  @critical @automated @high
69
78
  Scenario: [TC10001] Rocket Silo Is Unlocked
70
79
  Given a silo where the rockets are stored
@@ -129,6 +138,32 @@ straight from the command line:
129
138
  There are many more switches. Try exploring `crab --help` to find
130
139
  out more.
131
140
 
141
+ Troubleshooting
142
+ ---------------
143
+
144
+ This is still very rudimentary, but you can set `CRAB_LOG_LEVEL`
145
+ to one of the constants defined in `Logger` to see more output for
146
+ diagnosis. They are:
147
+
148
+ - 0: DEBUG
149
+ - 1: INFO
150
+ - 2: WARN
151
+ - 3: ERROR
152
+ - 4: FATAL
153
+ - 5: UNKNOWN
154
+
155
+ The default is `WARN`, which should be good enough for most day-to-day
156
+ usage, but if you are having trouble and would like to submit a bug
157
+ report, please try again with `CRAB_LOG_LEVEL` set to `0` or `1`:
158
+
159
+ $ CRAB_LOG_LEVEL=0 crab story show US1001
160
+ I, [2011-10-04T02:33:22.795535 #16754] INFO -- crab: Getting credentials...
161
+ I, [2011-10-04T02:33:22.795789 #16754] INFO -- crab: Connecting to Rally as cvillela@thoughtworks.com...
162
+ I, [2011-10-04T02:33:28.343039 #16754] INFO -- crab: Looking up story with ID US1001
163
+ I, [2011-10-04T02:33:31.861501 #16754] INFO -- crab: US1001: 1 test case(s) found
164
+ I, [2011-10-04T02:33:38.681445 #16754] INFO -- crab: TC10001: 3 step(s) found
165
+ ...
166
+
132
167
  i18n Support
133
168
  ------------
134
169
 
@@ -136,6 +171,10 @@ i18n Support
136
171
  Cucumber are also included:
137
172
 
138
173
  $ crab story show US1001 -l ja
174
+ # language: jp
175
+ # state: grooming
176
+ # fetched: 2011-10-04T13:32:35-03:00
177
+ # revision: 17, by cv@lixo.org
139
178
  機能: [US1001] Arms Rockets Upon Successful Boot
140
179
  ...
141
180
  シナリオ: [TC1501] Rocket Silo Is Unlocked
@@ -170,44 +209,15 @@ If you have any problems, please let us know.
170
209
  [4]: http://gembundler.com
171
210
  [5]: https://github.com/cucumber/aruba
172
211
 
173
- To do / Roadmap
174
- ---------------
175
-
176
- ### 0.2.0
212
+ To do / Roadmap / Known Bugs
213
+ ----------------------------
177
214
 
178
- - `pull` is not very smart and could detect feature files being moved from one dir to another
179
- - Recursively look for a `.crab` directory like Git does with `.git`
180
- - Make logging verbosity level configurable using a global command line option
181
- - Move more of the code away from the bin/ dir
182
- - More thorough automated testing of commands
183
-
184
- ### 0.3.0
185
-
186
- - Do not add "default" tags to scenarios (`@important`, `@medium`, `@manual` and `@acceptance`)
187
- - Figure out how to stub or simulate Rally (tests are taking way too long already)
188
- - Make better use of Aruba to make sure generated files are OK
189
- - Use the Gherkin models and formatters instead of dumb string templates to generate feature files
190
- - Add a `push` subcommand which parses a Cucumber feature and adds or updates it (and test cases) in Rally
191
- - Add a config command + `.crab/config` file to hold settings like project, etc
192
- - A way to work in batches, or offline -- much faster!
193
-
194
- ### 0.4.0
195
-
196
- - Error messages are still more cryptic than we'd like
197
- - Add a Cucumber Formatter that updates Test Runs in Rally with results from CI
198
- - Make it possible to associate defects with Features (essentially treating defects like stories)
199
- - Encrypt password in generated `~/.crab/credentials`
200
- - Test in Ruby 1.9
201
-
202
- ### Before 1.0.0
203
-
204
- - Bash completion scripts
205
- - Man pages
206
- - Logo
207
- - Website
215
+ Please see the [issues page][6] page.
208
216
 
209
217
  Suggestions? Please get in touch!
210
218
 
219
+ [6]: https://github.com/cv/crab/issues
220
+
211
221
  Authors and Contributors
212
222
  ------------------------
213
223
 
@@ -15,7 +15,6 @@ Feature: Show Story From Rally
15
15
  Scenario: Show Story With Test Cases
16
16
  When I run `crab story show US5000`
17
17
  Then the output should contain "Feature: [US5000] Sample Crab Parent Story"
18
- And the output should contain "@important @medium @manual @acceptance"
19
18
  And the output should contain "Scenario: [TC10388] Sample Testcase"
20
19
  And the output should contain " Given Rally behaves"
21
20
  And the output should contain " When I look at the test case steps"
@@ -19,14 +19,6 @@ Feature: Update Story in Rally
19
19
  Then the output should contain "US4988: Sample Crab Story (grooming)"
20
20
  And the story US4988 should be unblocked
21
21
 
22
- Scenario: Setting Iteration
23
- When I run `crab story update US4988 --iteration "Iteration 0"`
24
- Then the story US4988 should be in iteration "Iteration 0"
25
-
26
- Scenario: Setting Release
27
- When I run `crab story update US4988 --release "Beta release"`
28
- Then the story US4988 should be in release "Beta release"
29
-
30
22
  Scenario: Setting Parent
31
23
  When I run `crab story update US4988 --parent US5000`
32
24
  Then the story US4988 should have US5000 as its parent
@@ -12,6 +12,7 @@ require 'sanitize'
12
12
  require 'trollop'
13
13
 
14
14
  # internals
15
+ require "crab/logging"
15
16
  require "crab/utilities"
16
17
  require "crab/rally"
17
18
  require "crab/story"
@@ -16,7 +16,7 @@ module Crab
16
16
  formatter.feature feature
17
17
 
18
18
  if include_testcases
19
- Array(story.test_cases).tap {|tcs| logger.info "#{tcs.size} test case(s) found" }.each do |test_case|
19
+ Array(story.test_cases).tap {|tcs| logger.info "#{story.formatted_id}: #{tcs.size} test case(s) found" }.each do |test_case|
20
20
  formatter.scenario @adapter.scenario_from(test_case)
21
21
  @adapter.steps_from(test_case).each do |step|
22
22
  formatter.step step
@@ -0,0 +1,12 @@
1
+ module Crab::Logging
2
+
3
+ def logger
4
+ $logger ||= Logger.new(STDERR)
5
+ $logger.formatter = Logger::Formatter.new
6
+ $logger.progname = 'crab'
7
+ # TODO - make this a global command-line or config option:
8
+ $logger.level = ENV['CRAB_LOG_LEVEL'].present? ? ENV['CRAB_LOG_LEVEL'].to_i : Logger::WARN
9
+ $logger
10
+ end
11
+
12
+ end
@@ -7,7 +7,12 @@ class Crab::RallyToCucumberAdapter
7
7
  end
8
8
 
9
9
  def feature_from(story)
10
- comments = [Gherkin::Formatter::Model::Comment.new("# language: #{@language.iso_code}", 0)]
10
+ comments = [
11
+ "# language: #{@language.iso_code}",
12
+ "# state: #{story.state}",
13
+ "# fetched: #{DateTime.now}",
14
+ "# revision: #{story.revision}",
15
+ ].map {|c| Gherkin::Formatter::Model::Comment.new(c, 0) }
11
16
  tags = []
12
17
  keyword = @language.keywords('feature').last
13
18
  name = "[#{story.formatted_id}] #{story.name}"
@@ -18,7 +23,9 @@ class Crab::RallyToCucumberAdapter
18
23
  end
19
24
 
20
25
  def scenario_from(test_case)
21
- comments = []
26
+ comments = [
27
+ "# revision: #{test_case.revision}",
28
+ ].map {|c| Gherkin::Formatter::Model::Comment.new(c, 0) }
22
29
  tags = test_case.tags.map {|tag| Gherkin::Formatter::Model::Tag.new("@#{tag}", 0) }
23
30
  keyword = @language.keywords('scenario').last
24
31
  name = "[#{test_case.formatted_id}] #{test_case.name}"
@@ -29,7 +36,7 @@ class Crab::RallyToCucumberAdapter
29
36
  end
30
37
 
31
38
  def steps_from(test_case)
32
- test_case.steps.tap {|steps| logger.info "#{steps.size} step(s) found"}.map do |step|
39
+ test_case.steps.tap {|steps| logger.info "#{test_case.formatted_id}: #{steps.size} step(s) found"}.map do |step|
33
40
  step_words = step.split(' ')
34
41
  comments = []
35
42
  keyword = step_words.shift
@@ -2,6 +2,8 @@ module Crab
2
2
 
3
3
  class Story
4
4
 
5
+ include Crab::Utilities
6
+
5
7
  VALID_STATES = %w{Grooming Defined In-Progress Completed Accepted Released}
6
8
 
7
9
  def initialize(rally_story, dry_run)
@@ -29,6 +31,11 @@ module Crab
29
31
  (@rally_story.schedule_state || "unknown").parameterize.underscore
30
32
  end
31
33
 
34
+ def revision
35
+ rev = @rally_story.revision_history.revisions.first
36
+ "#{rev.revision_number}, by #{rev.user}"
37
+ end
38
+
32
39
  def description
33
40
  # this could use a lot of rethinking :(
34
41
  # biggest problem is that Cucumber breaks if text in description looks like something
@@ -67,12 +74,6 @@ module Crab
67
74
 
68
75
  private
69
76
 
70
- # took a while to figure out that we need to remove the CSS from inside embedded <style> tags!
71
- # Rally uses some crazy rich text editor that I'd be soooooo happy to disable, somehow. Chrome Extension, perhaps?
72
- def sanitize(source)
73
- Sanitize.clean source, :remove_contents => %w{style}
74
- end
75
-
76
77
  end
77
78
 
78
79
  module DryRun
@@ -2,6 +2,8 @@ module Crab
2
2
 
3
3
  class TestCase
4
4
 
5
+ include Crab::Utilities
6
+
5
7
  PRIORITIES = %w{useful important critical}
6
8
  RISKS = %w{low medium high}
7
9
  METHODS = %w{automated manual}
@@ -21,11 +23,22 @@ module Crab
21
23
  end
22
24
 
23
25
  def description
24
- @rally_test_case.description
26
+ # this could use a lot of rethinking :(
27
+ # biggest problem is that Cucumber breaks if text in description looks like something
28
+ # it might know how to parse, but doesn't
29
+ # our feature descriptions are quite like that, so I was being ultra-conservative
30
+ sanitize(@rally_test_case.description || '').gsub(/ +/, "\n").gsub(/\n\n/, "\n").gsub(/\n/, "\n ")
25
31
  end
26
32
 
27
33
  def tags
28
- [priority, risk, test_method, test_type].map &:parameterize
34
+ [priority, risk, test_method, test_type].map(&:parameterize).reject do |tag|
35
+ %w{important medium manual acceptance}.include? tag
36
+ end
37
+ end
38
+
39
+ def revision
40
+ rev = @rally_test_case.revision_history.revisions.first
41
+ "#{rev.revision_number}, by #{rev.user}"
29
42
  end
30
43
 
31
44
  def priority
@@ -1,13 +1,7 @@
1
1
  module Crab
2
2
  module Utilities
3
3
 
4
- def logger
5
- $logger ||= Logger.new(STDERR)
6
- $logger.formatter = Logger::Formatter.new
7
- $logger.progname = 'crab'
8
- # TODO - make this a global command-line or config option: $logger.level = Logger::WARN
9
- $logger
10
- end
4
+ include Logging
11
5
 
12
6
  def credentials_file
13
7
  FileUtils.mkdir_p File.expand_path("~/.crab")
@@ -77,5 +71,10 @@ module Crab
77
71
  result
78
72
  end
79
73
 
74
+ # took a while to figure out that we need to remove the CSS from inside embedded <style> tags!
75
+ # Rally uses some crazy rich text editor that I'd be soooooo happy to disable, somehow. Chrome Extension, perhaps?
76
+ def sanitize(source)
77
+ Sanitize.clean source, :remove_contents => %w{style}
78
+ end
80
79
  end
81
80
  end
@@ -1,3 +1,3 @@
1
1
  module Crab
2
- VERSION = "0.2.10"
2
+ VERSION = "0.2.11"
3
3
  end
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: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 10
10
- version: 0.2.10
9
+ - 11
10
+ version: 0.2.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Carlos Villela
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-03 00:00:00 -03:00
18
+ date: 2011-10-04 00:00:00 -03:00
19
19
  default_executable: crab
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -354,6 +354,7 @@ files:
354
354
  - lib/crab/cucumber_feature.rb
355
355
  - lib/crab/cucumber_scenario.rb
356
356
  - lib/crab/cucumber_to_rally_adapter.rb
357
+ - lib/crab/logging.rb
357
358
  - lib/crab/rally.rb
358
359
  - lib/crab/rally_to_cucumber_adapter.rb
359
360
  - lib/crab/story.rb