cucumber-to-rally 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cucumber-to-rally"
3
- s.version = "0.1.0"
3
+ s.version = "0.1.1"
4
4
  s.description = "A gem to configure a connection with Cucumber to work with Rally"
5
- s.summary = "Version 0.1.0"
5
+ s.summary = "Version 0.1.1"
6
6
  s.author = "Pablo Menezes"
7
7
  s.files = Dir["{lib/**/*.rb,README.rdoc,test/**/*.rb,Rakefile,*.gemspec}"]
8
8
  end
@@ -11,56 +11,87 @@ require 'fileutils'
11
11
 
12
12
  CONTENT = '# -*- encoding : utf-8 -*-
13
13
 
14
+
15
+ # => The function createTestCase, used in this example, don\'t use the complete params, so, all Test Cases created with
16
+ # => this hooks example will be this following values: Type: Functional, Method: Automated and Priority: Critical.
17
+ #
18
+ # => The order of params of this function are: workspace, project, name, description,owner, type, method, priority,id*
19
+ #
20
+ # => At the moment, the id param is useless. For the next review, your use will be studied
21
+ #
22
+
14
23
  cucumber = CucumberToRally::CucumberToRally.new
15
24
 
16
25
  #Params to Connect on Rally
17
- LOGIN =
18
- PASSWORD =
26
+ LOGIN = #Insert here your Rally login
27
+ PASSWORD = #Insert here your password
19
28
 
20
29
  #Params to create a Test Case Result
21
- WORKSPACE =
22
- PROJECT =
23
- BUILD = "Cucumber"
30
+ WORKSPACE = #Workspace of the Project
31
+ PROJECT = #Id of the Project
32
+ BUILD = #Default build, case you want to define a default Build Name
33
+
34
+
35
+
36
+
37
+ # The Before do "function" run before each scenario. In this hooks.rb file example, Before the scenario runs, I connect on Rally.
24
38
 
25
39
  Before do
40
+ # Connect to Rally before the Scenario run. Can be used after the scenario run too.
26
41
  cucumber.connect(LOGIN,PASSWORD)
27
42
  end
28
43
 
44
+ #The After do |scenario| "function" runs after each scenario. The scenario variable allow us to make some validations before save the Test Case Result or create a Test Case, if the scenario hasn\'t been created yet.
45
+
29
46
  After do |scenario|
47
+
48
+ #
49
+ # => The following lines are ways to identfy existing Test Cases, but nothing prevents you of using other ways
50
+ # => to identify existings Test Cases.
51
+ #
52
+
53
+ if scenario.source_tag_names.first == nil
54
+ TC_ID = 0
55
+ isId = "none"
56
+ else
57
+ isId = scenario.source_tag_names.first;
58
+ isId = isId.gsub("@","")
59
+ end
60
+
61
+ if isId.start_with?("TC")
62
+ TC_ID = isId
63
+ end
64
+
65
+ #This "if" will be executed only if the scenario fail.
30
66
  if (scenario.failed?)
31
67
  begin
32
- if (scenario.source_tag_names.first == "@configuration")
33
- Kernel.puts "Cenario de Configuracao. Guardando variaveis."
34
- else
35
- Kernel.puts "O cenario #{scenario.name} falhou!"
36
- if (TC_ID == 0)
37
- begin
38
- Kernel.puts "Criando Test Case\n"
39
- newTC = cucumber.createTestCase(WORKSPACE,PROJECT,scenario.name,"Teste de Execucao do Cucumber",OWNER,TYPE,METHOD,PRIORITY)
40
- Kernel.puts "Caso de Teste Criado: " + newTC.to_s
41
- cucumber.createFirstTestCaseResult(WORKSPACE,PROJECT,newTC.to_s,BUILD,"Pass")
42
- end
43
- else
44
- cucumber.createTestCaseResult(WORKSPACE,PROJECT,TC_ID,BUILD,"Fail")
68
+ Kernel.puts "The scenario #{scenario.name} failed!" #Sends a message to the prompt!
69
+ if (TC_ID == 0) # Case the TC_ID constant isn\'t defined, a new Test Case will be created!
70
+ begin
71
+ Kernel.puts "Creating Test Case\n" #Sends a message to the prompt!
72
+ newTC = cucumber.createTestCase(WORKSPACE,PROJECT,scenario.name,"Cucumber Execution Test")
73
+ Kernel.puts "Test Case created: " + newTC.to_s # Sends to the prompt, if the Test Case was created.
74
+ cucumber.createFirstTestCaseResult(WORKSPACE,PROJECT,newTC.to_s,BUILD,"Fail") #Create a result for the Test Case created
45
75
  end
76
+ else
77
+ cucumber.createTestCaseResult(WORKSPACE,PROJECT,TC_ID,BUILD,"Fail") #Just runs if the ID was informated.
46
78
  end
47
79
  end
48
- else
80
+ end
81
+
82
+ #This if will be executed only if the scenario pass.
83
+ if (scenario.passed?)
49
84
  begin
50
- if (scenario.source_tag_names.first == "@configuration")
51
- Kernel.puts "Cenario de Configuracao. Guardando variaveis."
52
- else
53
- Kernel.puts "O cenario #{scenario.name} foi executado com sucesso!"
54
- if (TC_ID == 0)
85
+ Kernel.puts "The scenario #{scenario.name} passed!" #Sends a message to the prompt
86
+ if (TC_ID == 0) # Case the TC_ID constant isn\'t defined, a new Test Case will be created!
55
87
  begin
56
- Kernel.puts "Criando Test Case\n"
57
- newTC = cucumber.createTestCase(WORKSPACE,PROJECT,scenario.name,"Teste de Execucao do Cucumber",OWNER,TYPE,METHOD,PRIORITY)
58
- Kernel.puts "Caso de Teste Criado: " + newTC.to_s
59
- cucumber.createFirstTestCaseResult(WORKSPACE,PROJECT,newTC.to_s,BUILD,"Pass")
60
- end
61
- else
62
- cucumber.createTestCaseResult(WORKSPACE,PROJECT,TC_ID,BUILD,"Pass")
88
+ Kernel.puts "Creating Test Case\n" #Sends a message to the prompt
89
+ newTC = cucumber.createTestCase(WORKSPACE,PROJECT,scenario.name,"Cucumber Execution Test")
90
+ Kernel.puts "Test Case created: " + newTC.to_s # Sends to the prompt, if the Test Case was created.
91
+ cucumber.createFirstTestCaseResult(WORKSPACE,PROJECT,newTC.to_s,BUILD,"Pass") #Create a result for the Test Case created
63
92
  end
93
+ else
94
+ cucumber.createTestCaseResult(WORKSPACE,PROJECT,TC_ID,BUILD,"Pass") #Just runs if the ID was informated
64
95
  end
65
96
  end
66
97
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-to-rally
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,7 +18,7 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - lib/cucumber-to-rally.rb
21
- - test/cucumberToRally_test.rb
21
+ - test/cucumber-to-rally_test.rb
22
22
  - Rakefile
23
23
  - cucumber-to-rally.gemspec
24
24
  homepage:
@@ -44,6 +44,6 @@ rubyforge_project:
44
44
  rubygems_version: 1.8.21
45
45
  signing_key:
46
46
  specification_version: 3
47
- summary: Version 0.1.0
47
+ summary: Version 0.1.1
48
48
  test_files: []
49
49
  has_rdoc: