cucumber-mingle 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/README +0 -0
- data/cucumber-mingle.gemspec +26 -0
- data/examples/calculator.mingle +0 -0
- data/examples/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/features/support/env.rb +18 -0
- data/examples/lib/calculator.rb +14 -0
- data/lib/cucumber/mingle.rb +107 -0
- metadata +121 -0
data/Gemfile
ADDED
data/README
ADDED
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'cucumber-mingle'
|
6
|
+
s.version = '1.0.0'
|
7
|
+
s.authors = ["Vincent Xu"]
|
8
|
+
s.description = 'Cucumber Mingle Integration'
|
9
|
+
s.summary = 'cucumber-mingle-1.0.0'
|
10
|
+
s.email = 'vincent.hao.xu@gmail.com'
|
11
|
+
|
12
|
+
s.platform = Gem::Platform::RUBY
|
13
|
+
|
14
|
+
s.add_dependency 'cucumber', '~> 0.9.2'
|
15
|
+
s.add_dependency 'activeresource', '~> 3.0.1'
|
16
|
+
|
17
|
+
s.add_development_dependency 'rake', '~> 0.8.7'
|
18
|
+
# s.add_development_dependency 'rcov', '~> 0.9.9'
|
19
|
+
|
20
|
+
s.rubygems_version = "1.3.7"
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
# s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
# s.extra_rdoc_files = ["LICENSE", "README.rdoc", "History.txt"]
|
24
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
25
|
+
s.require_path = "lib"
|
26
|
+
end
|
Binary file
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end
|
3
|
+
require 'cucumber/formatter/unicode'
|
4
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
5
|
+
require 'calculator'
|
6
|
+
|
7
|
+
Before do
|
8
|
+
@calc = Calculator.new
|
9
|
+
end
|
10
|
+
|
11
|
+
After do
|
12
|
+
end
|
13
|
+
|
14
|
+
Given /I have entered (\d+) into the calculator/ do |n|
|
15
|
+
@calc.push n.to_i
|
16
|
+
end
|
17
|
+
|
18
|
+
When /I press (\w+)/ do |op|
|
19
|
+
@result = @calc.send op
|
20
|
+
end
|
21
|
+
|
22
|
+
Then /the result should be (.*) on the screen/ do |result|
|
23
|
+
@result.should == result.to_f
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'cucumber/mingle'
|
2
|
+
|
3
|
+
AfterConfiguration do |config|
|
4
|
+
Cucumber::Mingle.features config, :host => 'http://localhost:8080', :user => 'vincentx',
|
5
|
+
:password => 'password', :project => 'calculator', :filters => 'Type IS Story'
|
6
|
+
Cucumber::Mingle.results do |invalid_cards, passed, failed, pending|
|
7
|
+
count = passed.length + failed.length + pending.length
|
8
|
+
test_report = Cucumber::Mingle::Card.new
|
9
|
+
test_report.name = "#{Time.now}"
|
10
|
+
test_report.type = 'Test Report'
|
11
|
+
test_report.description = ''
|
12
|
+
test_report.save
|
13
|
+
test_report = Cucumber::Mingle::Card.find_by_number(test_report.id)
|
14
|
+
test_report['Scenario Count'] = count
|
15
|
+
test_report['Automated Scenario Count'] = count-pending.length
|
16
|
+
test_report.save
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_resource'
|
3
|
+
|
4
|
+
module Cucumber
|
5
|
+
module Mingle
|
6
|
+
@invalid_cards = []
|
7
|
+
|
8
|
+
def self.features(config, options)
|
9
|
+
url = "#{options[:host]}/api/v2/projects/#{options[:project]}"
|
10
|
+
Card.site, Card.filters = url, options[:filter]
|
11
|
+
Card.user, Card.password = options[:user], options[:password]
|
12
|
+
config.formats << ['Cucumber::Mingle::Formatter', config.out_stream]
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.report_invaild_card(card)
|
16
|
+
@invalid_cards << card
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.summary(passed, failed, pending)
|
20
|
+
to_scenario = Proc.new {|s| Scenario.new(s)}
|
21
|
+
@handler.call(@invalid_cards, passed.map(&to_scenario), failed.map(&to_scenario), pending.map(&to_scenario)) if @handler
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.results(&handler)
|
25
|
+
@handler = handler
|
26
|
+
end
|
27
|
+
|
28
|
+
class Scenario
|
29
|
+
attr_reader :source, :card, :feature
|
30
|
+
|
31
|
+
def initialize(source)
|
32
|
+
@source = source
|
33
|
+
@feature = source.feature rescue source.scenario_outline.feature
|
34
|
+
@card = @feature.card
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class Card < ActiveResource::Base
|
39
|
+
def self.filters=(filters)
|
40
|
+
@filters = filters
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.find_by_number(number)
|
44
|
+
card = self.find(number)
|
45
|
+
card.id = card.number
|
46
|
+
card
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.all
|
50
|
+
!@filters ? self.find(:all, :params=> {:page => 'all'}) : self.find(:all, :params => {:page => 'all', 'filters[mql]'.to_sym => @filters})
|
51
|
+
end
|
52
|
+
|
53
|
+
def type
|
54
|
+
attributes['card_type_name']
|
55
|
+
end
|
56
|
+
|
57
|
+
def type=(type)
|
58
|
+
attributes['card_type_name'] = type
|
59
|
+
end
|
60
|
+
|
61
|
+
def [](name)
|
62
|
+
property = properties.find { |p| p.name == name }
|
63
|
+
property.value if property
|
64
|
+
end
|
65
|
+
|
66
|
+
def []=(name, value)
|
67
|
+
property = properties.find { |p| p.name == name }
|
68
|
+
property.value = value if property
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
class Formatter
|
73
|
+
def initialize(step_mother, io, options)
|
74
|
+
@step_mother = step_mother
|
75
|
+
end
|
76
|
+
|
77
|
+
def after_features(*args)
|
78
|
+
Cucumber::Mingle.summary(@step_mother.scenarios(:passed), @step_mother.scenarios(:failed), @step_mother.scenarios(:undefined))
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class Cucumber::Runtime
|
85
|
+
alias cucumber_features features
|
86
|
+
def features
|
87
|
+
filters = []
|
88
|
+
features = Cucumber::Ast::Features.new
|
89
|
+
Cucumber::Mingle::Card.all.map do | card |
|
90
|
+
feature_file = Cucumber::FeatureFile.new("#{card.number}-#{card.name}.feature", card.description)
|
91
|
+
feature = feature_file.parse(filters, {}) rescue nil
|
92
|
+
if feature
|
93
|
+
class <<feature
|
94
|
+
attr_accessor :card
|
95
|
+
end
|
96
|
+
feature.card = card
|
97
|
+
features.add_feature(feature)
|
98
|
+
else
|
99
|
+
Cucumber::Mingle.report_invaild_card(card)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
features
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cucumber-mingle
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Vincent Xu
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-11-03 00:00:00 +08:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: cucumber
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 63
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 9
|
33
|
+
- 2
|
34
|
+
version: 0.9.2
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: activeresource
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 5
|
46
|
+
segments:
|
47
|
+
- 3
|
48
|
+
- 0
|
49
|
+
- 1
|
50
|
+
version: 3.0.1
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rake
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 49
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
- 8
|
65
|
+
- 7
|
66
|
+
version: 0.8.7
|
67
|
+
type: :development
|
68
|
+
version_requirements: *id003
|
69
|
+
description: Cucumber Mingle Integration
|
70
|
+
email: vincent.hao.xu@gmail.com
|
71
|
+
executables: []
|
72
|
+
|
73
|
+
extensions: []
|
74
|
+
|
75
|
+
extra_rdoc_files: []
|
76
|
+
|
77
|
+
files:
|
78
|
+
- Gemfile
|
79
|
+
- README
|
80
|
+
- cucumber-mingle.gemspec
|
81
|
+
- examples/calculator.mingle
|
82
|
+
- examples/features/step_definitons/calculator_steps.rb
|
83
|
+
- examples/features/support/env.rb
|
84
|
+
- examples/lib/calculator.rb
|
85
|
+
- lib/cucumber/mingle.rb
|
86
|
+
has_rdoc: true
|
87
|
+
homepage:
|
88
|
+
licenses: []
|
89
|
+
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options:
|
92
|
+
- --charset=UTF-8
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
hash: 3
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
version: "0"
|
113
|
+
requirements: []
|
114
|
+
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 1.3.7
|
117
|
+
signing_key:
|
118
|
+
specification_version: 3
|
119
|
+
summary: cucumber-mingle-1.0.0
|
120
|
+
test_files: []
|
121
|
+
|