crab 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,6 +3,5 @@
3
3
  Gemfile.lock
4
4
  pkg/*
5
5
  tmp
6
- .rally_credentials
7
6
  tags
8
- .rally_project
7
+ .crab
data/README.md CHANGED
@@ -85,7 +85,7 @@ There are more switches. Check out `crab update --help` to find out more.
85
85
  Developing
86
86
  ----------
87
87
 
88
- To develop `crab`, you are going to need [`bundler`][3], [Aruba][4] and a
88
+ To develop `crab`, you are going to need [Bundler][3], [Aruba][4] and a
89
89
  working Rally account with a project set up where you can edit things. The
90
90
  supplied `Gemfile` should take care of everything else:
91
91
 
@@ -103,20 +103,18 @@ To do
103
103
  -----
104
104
 
105
105
  - Add a config command + .crab/config file to hold settings like project, etc
106
- - Remove account-specific Rally tests
107
106
  - Ability to create and delete stories with all mandatory fields from the command line
108
107
  - Add a `push` subcommand which parses a Cucumber feature and adds or updates it in Rally
109
108
  - Add a way to create, edit and delete test cases / scenarios from the command line
110
109
  - `pull` is not very smart and could detect feature files being moved from one dir to another
111
- - Recursively look for a `.rally_project` file like Git does with `.git` dirs
112
- - Encrypt password in generated `~/.rally_credentials`
110
+ - Recursively look for a `.crab` directory like Git does with `.git`
111
+ - Encrypt password in generated `~/.crab/credentials`
113
112
  - Verbose logging (especially before any change or destructive operations in Rally)
114
113
  - Dry-run mode
115
114
  - Figure out how to stub or simulate Rally (tests are taking way too long already)
116
115
  - Error messages are still more cryptic than we'd like
117
116
  - Add a `move` subcommand which moves the story from one state to the next (potentially, `move --back`)
118
117
  - Add a Cucumber Formatter that updates Test Runs in Rally with results from CI
119
- - Add `@manual` tags to Test Cases marked as such
120
118
  - Investigate use of other fields like Priority and Risk in Rally Test Cases
121
119
  - Support i18n Cucumber Features
122
120
  - Make it possible to associate defects with Features (essentially treating defects like stories)
data/Rakefile CHANGED
@@ -7,3 +7,18 @@ end
7
7
 
8
8
  task :default => :features
9
9
 
10
+ namespace :cucumber do
11
+
12
+ desc "Basic test suite set-up"
13
+ task :setup do
14
+ require 'highline/import'
15
+ test_project = ask("Name of the project in Rally to be used for tests: ")
16
+
17
+ dot_crab = File.expand_path("~/.crab")
18
+ FileUtils.mkdir_p dot_crab
19
+ File.open(File.join(dot_crab, 'test_project'), 'w') do |file|
20
+ file.puts test_project
21
+ end
22
+ end
23
+
24
+ end
@@ -6,7 +6,7 @@ Feature: Find Text in Stories
6
6
 
7
7
  Background:
8
8
  Given I am logged in
9
- And I have selected the project "VEJA SP - Migração para o Alexandria"
9
+ And I have selected my test project
10
10
 
11
11
  Scenario: Matching Name
12
12
  When I run `crab find Sample Crab`
@@ -10,5 +10,5 @@ Feature: Log In and Out of Rally
10
10
  And I type my username
11
11
  And I type my password
12
12
  Then the exit status should be 0
13
- And the user's home directory should have a file named ".rally_credentials"
13
+ And the user's home directory should have a file named ".crab/credentials"
14
14
 
@@ -13,11 +13,11 @@ Feature: Project Selection
13
13
  When I run `crab project`
14
14
  Then the output should contain "No project currently selected."
15
15
 
16
- When I run `crab project "VEJA SP - Migração para o Alexandria"`
16
+ When I select my test project
17
17
  Then the exit status should be 0
18
18
 
19
19
  When I run `crab project`
20
- Then the output should contain "VEJA SP - Migração para o Alexandria"
20
+ Then the output should be the name of my test project
21
21
 
22
22
  Scenario: Selecting an Invalid Project
23
23
  When I run `crab project "invalid"`
@@ -19,6 +19,7 @@ Sample Description
19
19
  Scenario: Show Story With Test Cases
20
20
  When I run `crab show US5000`
21
21
  Then the output should contain "Feature: [US5000] Sample Crab Parent Story"
22
+ And the output should contain "@manual @functional"
22
23
  And the output should contain "Scenario: [TC10388] Sample Testcase"
23
24
  And the output should contain " Given Rally behaves"
24
25
  And the output should contain " When I look at the test case steps"
@@ -14,7 +14,7 @@ Then /^the user's home directory should have a file named "([^"]*)"$/ do |file|
14
14
  end
15
15
 
16
16
  def get_rally_credentials
17
- username, password = File.read(File.join(File.dirname(__FILE__), '..', '..', '.rally_credentials')).split(/\n/)
17
+ username, password = File.read(File.join(File.dirname(__FILE__), '..', '..', '.crab', 'credentials')).split(/\n/)
18
18
  [ username, password ]
19
19
  end
20
20
 
@@ -75,12 +75,12 @@ Then /^the story ([A-Z]{2}\d+) should have ([A-Z]{2}\d+) as its parent$/ do |chi
75
75
  end
76
76
 
77
77
  Given /^no project is selected$/ do
78
- Given 'I run `rm -rf ".rally_project"`'
78
+ Given 'I run `rm -rf ".crab/project"`'
79
79
  end
80
80
 
81
81
  def get_project
82
- if File.exists? ".rally_project"
83
- File.read(".rally_project").strip
82
+ if File.exists? ".crab/project"
83
+ File.read(".crab/project").strip
84
84
  end
85
85
  end
86
86
 
@@ -92,3 +92,23 @@ Given /^I have selected the project "([^"]*)"$/ do |project|
92
92
  }
93
93
  end
94
94
  end
95
+
96
+ def get_test_project
97
+ begin
98
+ test_project = File.read(File.expand_path("~/.crab/test_project"))
99
+ rescue
100
+ raise "Looks like your test project isn't set up. Please run 'rake cucumber:setup'"
101
+ end
102
+ end
103
+
104
+ Given /^I have selected my test project$/ do
105
+ When %Q{I run `crab project "#{get_test_project}"`}
106
+ end
107
+
108
+ When /^I select my test project$/ do
109
+ When %Q{I run `crab project "#{get_test_project}"`}
110
+ end
111
+
112
+ Then /^the output should be the name of my test project$/ do
113
+ Then %Q{the output should contain "#{get_test_project}"}
114
+ end
@@ -1,8 +1,10 @@
1
1
  module Crab
2
2
  class CucumberScenario
3
3
  def generate_from(scenario)
4
+ tags = [scenario.method, scenario.test_type]
4
5
  return <<-SCENARIO
5
6
 
7
+ #{tags.map {|t| " @" + t.strip }.join}
6
8
  Scenario: [#{scenario.formatted_id}] #{scenario.name}
7
9
  #{scenario.steps.join("\n ")}
8
10
  SCENARIO
@@ -2,8 +2,8 @@ module Crab
2
2
  class Project
3
3
 
4
4
  def self.current_project_name
5
- if File.exists? ".rally_project"
6
- File.read(".rally_project").strip
5
+ if File.exists? ".crab/project"
6
+ File.read(".crab/project").strip
7
7
  end
8
8
  end
9
9
 
@@ -30,7 +30,8 @@ module Crab
30
30
  project = @rally.find_project name
31
31
  Trollop::die "#{name.inspect} is not a valid project" if project.nil?
32
32
 
33
- File.open(".rally_project", "w") do |file|
33
+ FileUtils.mkdir_p ".crab"
34
+ File.open(".crab/project", "w") do |file|
34
35
  file.puts project.name
35
36
  end
36
37
  end
@@ -18,6 +18,13 @@ module Crab
18
18
  Array(@rally_test_case.steps).map {|step| step.input }
19
19
  end
20
20
 
21
+ def method
22
+ @rally_test_case.elements[:method].parameterize
23
+ end
24
+
25
+ def test_type
26
+ @rally_test_case.elements[:type].parameterize
27
+ end
21
28
  end
22
29
 
23
30
  end
@@ -1,7 +1,8 @@
1
1
  module Crab
2
2
  module Utilities
3
3
  def credentials_file
4
- File.expand_path("~/.rally_credentials")
4
+ FileUtils.mkdir_p File.expand_path("~/.crab")
5
+ File.expand_path("~/.crab/credentials")
5
6
  end
6
7
 
7
8
  def valid_credentials_file
@@ -1,3 +1,3 @@
1
1
  module Crab
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
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: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Carlos Villela