cuukie 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -2
- data/README.markdown +44 -2
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/cuukie_server +4 -1
- data/cuukie.gemspec +5 -3
- data/doc/backlog.txt +34 -14
- data/doc/pomodoro.txt +11 -0
- data/lib/cuukie/cucumber/formatter/cuukie.rb +29 -6
- data/lib/cuukie/public/cuukie.js +1 -1
- data/lib/cuukie/server.rb +64 -5
- data/lib/cuukie/views/index.erb +23 -1
- data/spec/commands_spec.rb +60 -9
- data/spec/cuukie_spec.rb +32 -49
- data/spec/spec_helper.rb +43 -0
- data/spec/test_project/features/{1_visualize_scenarios.feature → 1_show_scenarios.feature} +1 -1
- data/spec/test_project/features/3_failed_background.feature +1 -1
- data/spec/test_project/features/4_show_multiline_args.feature +19 -0
- data/spec/test_project/features/step_definitions/example_steps.rb +13 -1
- metadata +16 -14
data/.travis.yml
CHANGED
data/README.markdown
CHANGED
@@ -1,5 +1,47 @@
|
|
1
|
-
Cuukie
|
1
|
+
# Cuukie
|
2
|
+
|
3
|
+
Cuukie shows your Cucumber results on a web page.
|
2
4
|
|
3
5
|
[![Build Status](https://secure.travis-ci.org/nusco/cuukie.png)](http://travis-ci.org/nusco/cuukie.png)
|
4
6
|
|
5
|
-
|
7
|
+
## Using it
|
8
|
+
|
9
|
+
Install Cuukie:
|
10
|
+
|
11
|
+
gem install cuukie
|
12
|
+
|
13
|
+
(Or better still, you can use Bundler).
|
14
|
+
|
15
|
+
Require Cuukie from any file in your _features/support_ directory:
|
16
|
+
|
17
|
+
require 'cuukie'
|
18
|
+
|
19
|
+
Start the Cuukie server from a terminal window and leave it running:
|
20
|
+
|
21
|
+
cuukie_server
|
22
|
+
|
23
|
+
Leave the server running. When you run Cucumber, ask it to use the _cuukie_ formatter:
|
24
|
+
|
25
|
+
cucumber --format cuukie
|
26
|
+
|
27
|
+
To look at the results, open this page in a browser:
|
28
|
+
|
29
|
+
http://localhost:4569
|
30
|
+
|
31
|
+
## Custom port/server
|
32
|
+
|
33
|
+
You can pick a port when you start the cuukie_server...
|
34
|
+
|
35
|
+
cuukie_server 4570
|
36
|
+
|
37
|
+
...and you can tell the cuukie formatter where to look for the server:
|
38
|
+
|
39
|
+
cucumber --format cuukie CUUKIE_SERVER=http://my.server:4570
|
40
|
+
|
41
|
+
## Cuukie Vision
|
42
|
+
|
43
|
+
Right now, Cuukie is not any more useful than Cucumber's own HTML formatter. My plan is to make it more dynamic. You'll be able to see your steps as they run, just like you do with the default command-line formatter - but on a web page. Cuukie wants to be a good choice both when you want to run Cucumber tests locally, and when you want to show Cucumber tests on your build machine.
|
44
|
+
|
45
|
+
## License
|
46
|
+
|
47
|
+
MIT License. Copyright (c) 2011 Paolo "Nusco" Perrotta.
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/bin/cuukie_server
CHANGED
data/cuukie.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "cuukie"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Paolo \"Nusco\" Perrotta"]
|
12
|
-
s.date = "2011-12-
|
12
|
+
s.date = "2011-12-07"
|
13
13
|
s.description = "Shows Cucumber results on a web page as they run."
|
14
14
|
s.email = "paolo.nusco.perrotta@gmail.com"
|
15
15
|
s.executables = ["cuukie_server"]
|
@@ -39,9 +39,11 @@ Gem::Specification.new do |s|
|
|
39
39
|
"lib/test.rb",
|
40
40
|
"spec/commands_spec.rb",
|
41
41
|
"spec/cuukie_spec.rb",
|
42
|
-
"spec/
|
42
|
+
"spec/spec_helper.rb",
|
43
|
+
"spec/test_project/features/1_show_scenarios.feature",
|
43
44
|
"spec/test_project/features/2_multiple_features.feature",
|
44
45
|
"spec/test_project/features/3_failed_background.feature",
|
46
|
+
"spec/test_project/features/4_show_multiline_args.feature",
|
45
47
|
"spec/test_project/features/step_definitions/example_steps.rb",
|
46
48
|
"spec/test_project/features/support/formatters.rb"
|
47
49
|
]
|
data/doc/backlog.txt
CHANGED
@@ -1,24 +1,44 @@
|
|
1
|
-
MMF 0.
|
2
|
-
- use formatter after installing gem
|
3
|
-
- updated README
|
4
|
-
- deal with Scenario Examples
|
5
|
-
- show tables in Scenarios
|
6
|
-
- show wrap-up for Scenarios
|
7
|
-
- show wrap-up for Steps
|
8
|
-
- show running time
|
9
|
-
- configure server and port
|
10
|
-
- work with Ruby 1.8.7
|
11
|
-
- fail gracefully when cuukie_server is down
|
12
|
-
MMF 0.3
|
1
|
+
MMF 0.4
|
13
2
|
- show exceptions
|
14
3
|
- show code snippets
|
15
|
-
MMF 0.
|
16
|
-
- show incomplete
|
4
|
+
MMF 0.5
|
5
|
+
- show incomplete suite
|
17
6
|
- show undefined Scenarios/suite
|
18
7
|
- show undefined Steps
|
8
|
+
- show incomplete wrap-up for steps/scenarios
|
9
|
+
- show incomplete running time
|
10
|
+
MMF 0.6
|
11
|
+
- deal with Scenario Examples
|
19
12
|
MMF 1.0
|
20
13
|
- nice graphics
|
21
14
|
- self-updating Steps
|
22
15
|
- self-updating Scenarios
|
23
16
|
- self-updating suite
|
17
|
+
- self-updating scenario wrap-up
|
18
|
+
- self-updating step wrap-up
|
24
19
|
- self-updating running time
|
20
|
+
|
21
|
+
Then...
|
22
|
+
|
23
|
+
- show tags
|
24
|
+
|
25
|
+
- filter by tag
|
26
|
+
|
27
|
+
- show status for each table row (table rows have an
|
28
|
+
associated status in Cucumber formatters, and the
|
29
|
+
HTML formatter seems to take advantage of this. Why?
|
30
|
+
And what consequences does this have on the way
|
31
|
+
Scenario status is calculated in Cuukie?)
|
32
|
+
|
33
|
+
- find better way to manage Scenario/Step status (Cuukie
|
34
|
+
calculates the status of Scenarios with a few ugly
|
35
|
+
ifs and other dirty tricks. Maybe that information
|
36
|
+
is already known to the formatter, and it's
|
37
|
+
just a matter of using the right formatter events?)
|
38
|
+
|
39
|
+
- check rbx bug (interestingly, Rubynius has a different
|
40
|
+
idea of where a "step" is. it seems to return different
|
41
|
+
lines for steps than other rubies. I removed the line
|
42
|
+
numbers from tests b/c of this, and b/c they made the
|
43
|
+
tests fragile. Try to put back the line numbers,
|
44
|
+
and test under rbx)
|
data/doc/pomodoro.txt
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
I use this file to track my own work on the project. Each line is a pomodoro (a 25' slot).
|
2
2
|
Latest pomodoro comes first:
|
3
3
|
|
4
|
+
- run formatter with custom server
|
5
|
+
- run formatter with custom server
|
6
|
+
- run server on custom port
|
7
|
+
- wrap-ups for steps and scenarios
|
8
|
+
- wrap-ups for steps and scenarios
|
9
|
+
- show multiline arguments
|
10
|
+
- compatibility with ruby 1.8.7 and rbx
|
11
|
+
- fix ambiguous steps in test features
|
12
|
+
- support for tables
|
13
|
+
- fail gracefully when cuukie_server is down
|
14
|
+
- working formatter out of gem (DONE)
|
4
15
|
- working formatter out of gem
|
5
16
|
- working formatter out of gem
|
6
17
|
- show skipped scenarios
|
@@ -4,7 +4,13 @@ require 'json'
|
|
4
4
|
module Cucumber
|
5
5
|
module Formatter
|
6
6
|
class Cuukie
|
7
|
-
def initialize(step_mother,
|
7
|
+
def initialize(step_mother, path_or_io, options)
|
8
|
+
@server = ENV['CUUKIE_SERVER'] || 'http://localhost:4569'
|
9
|
+
ping
|
10
|
+
rescue
|
11
|
+
puts "I cannot find the cuukie_server on #{@server}."
|
12
|
+
puts "Please start the server with the cuukie_server command."
|
13
|
+
exit
|
8
14
|
end
|
9
15
|
|
10
16
|
def before_features(features)
|
@@ -12,6 +18,7 @@ module Cucumber
|
|
12
18
|
end
|
13
19
|
|
14
20
|
def before_feature(feature)
|
21
|
+
# TODO: use symbols as hash keys?
|
15
22
|
post 'before_feature', { 'short_name' => feature.short_name,
|
16
23
|
'description' => feature.description }
|
17
24
|
end
|
@@ -35,15 +42,31 @@ module Cucumber
|
|
35
42
|
def after_steps(*)
|
36
43
|
post 'after_steps'
|
37
44
|
end
|
38
|
-
|
39
|
-
def
|
40
|
-
post '
|
45
|
+
|
46
|
+
def before_table_row(table_row)
|
47
|
+
post 'before_table_row'
|
41
48
|
end
|
42
|
-
|
49
|
+
|
50
|
+
def table_cell_value(value, status)
|
51
|
+
post 'table_cell_value', { 'value' => value }
|
52
|
+
end
|
53
|
+
|
54
|
+
def doc_string(string)
|
55
|
+
post 'doc_string', { 'multiline_string' => string }
|
56
|
+
end
|
57
|
+
|
58
|
+
def after_features(features)
|
59
|
+
post 'after_features', { 'duration' => features.duration }
|
60
|
+
end
|
61
|
+
|
43
62
|
private
|
44
63
|
|
45
64
|
def post(url, params = {})
|
46
|
-
RestClient.post "
|
65
|
+
RestClient.post "#{@server}/#{url}", params.to_json
|
66
|
+
end
|
67
|
+
|
68
|
+
def ping
|
69
|
+
RestClient.get "#{@server}/ping"
|
47
70
|
end
|
48
71
|
end
|
49
72
|
end
|
data/lib/cuukie/public/cuukie.js
CHANGED
data/lib/cuukie/server.rb
CHANGED
@@ -3,19 +3,25 @@ require 'json'
|
|
3
3
|
|
4
4
|
module Cuukie
|
5
5
|
class Server < Sinatra::Base
|
6
|
-
set :port, 4569
|
7
6
|
set :features, []
|
8
7
|
set :build_status, nil
|
8
|
+
set :stats, {:scenarios => '', :steps => ''}
|
9
|
+
set :duration, '?'
|
9
10
|
|
10
11
|
get '/' do
|
11
|
-
@features
|
12
|
+
@features = settings.features
|
12
13
|
@build_status = settings.build_status
|
14
|
+
@duration = settings.duration
|
15
|
+
@stats = settings.stats
|
13
16
|
erb :index
|
14
17
|
end
|
15
18
|
|
16
19
|
post '/before_features' do
|
17
20
|
settings.features.clear
|
18
21
|
settings.build_status = nil
|
22
|
+
settings.stats = {:scenarios => '', :steps => ''}
|
23
|
+
settings.duration = '?'
|
24
|
+
settings.build_status = nil
|
19
25
|
end
|
20
26
|
|
21
27
|
post '/before_feature' do
|
@@ -36,7 +42,9 @@ module Cuukie
|
|
36
42
|
end
|
37
43
|
|
38
44
|
post '/before_step_result' do
|
39
|
-
|
45
|
+
step = read_from_request
|
46
|
+
step['table'] = []
|
47
|
+
current_scenario['steps'] << step
|
40
48
|
'OK'
|
41
49
|
end
|
42
50
|
|
@@ -58,12 +66,33 @@ module Cuukie
|
|
58
66
|
current_scenario['status'] ||= 'passed'
|
59
67
|
'OK'
|
60
68
|
end
|
61
|
-
|
69
|
+
|
70
|
+
post '/before_table_row' do
|
71
|
+
current_step['table'] << []
|
72
|
+
'OK'
|
73
|
+
end
|
74
|
+
|
75
|
+
post '/table_cell_value' do
|
76
|
+
data = read_from_request
|
77
|
+
current_step['table'].last << data['value']
|
78
|
+
'OK'
|
79
|
+
end
|
80
|
+
|
81
|
+
post '/doc_string' do
|
82
|
+
data = read_from_request
|
83
|
+
current_step['multiline_string'] = data['multiline_string']
|
84
|
+
'OK'
|
85
|
+
end
|
86
|
+
|
62
87
|
post '/after_features' do
|
88
|
+
data = read_from_request
|
89
|
+
min, sec = data['duration'].to_f.divmod(60)
|
90
|
+
settings.duration = "#{min}m#{'%.3f' % sec}s"
|
63
91
|
settings.build_status ||= 'passed'
|
92
|
+
settings.stats = stats
|
64
93
|
'OK'
|
65
94
|
end
|
66
|
-
|
95
|
+
|
67
96
|
get('/ping') { 'pong!' }
|
68
97
|
delete('/') { exit! }
|
69
98
|
|
@@ -84,6 +113,36 @@ module Cuukie
|
|
84
113
|
current_scenario['steps'].last
|
85
114
|
end
|
86
115
|
|
116
|
+
def stats
|
117
|
+
scenarios = []
|
118
|
+
settings.features.each {|feature| scenarios.concat feature['scenarios'] }
|
119
|
+
|
120
|
+
result = {:scenarios => String.new, :steps => String.new}
|
121
|
+
result[:scenarios] << dump_count(scenarios.size, "scenario")
|
122
|
+
result[:scenarios] << counts(scenarios)
|
123
|
+
|
124
|
+
steps = []
|
125
|
+
scenarios.each {|scenario| steps.concat scenario['steps'] }
|
126
|
+
result[:steps] << dump_count(steps.size, "step")
|
127
|
+
step_count = counts steps
|
128
|
+
result[:steps] << step_count if step_count
|
129
|
+
result
|
130
|
+
end
|
131
|
+
|
132
|
+
# shamelessly ripped from Cucumber's HTML formatter
|
133
|
+
def counts(elements)
|
134
|
+
counts = ['failed', 'skipped', 'undefined', 'pending', 'passed'].map do |status|
|
135
|
+
selected = elements.find_all {|element| element['status'] == status }
|
136
|
+
selected.any? ? "#{selected.size} #{status}" : nil
|
137
|
+
end.compact
|
138
|
+
counts.any? ? " (#{counts.join(', ')})" : ''
|
139
|
+
end
|
140
|
+
|
141
|
+
# also shamelessly ripped from Cucumber's HTML formatter
|
142
|
+
def dump_count(count, what, state=nil)
|
143
|
+
[count, state, "#{what}#{count == 1 ? '' : 's'}"].compact.join(' ')
|
144
|
+
end
|
145
|
+
|
87
146
|
include Rack::Utils
|
88
147
|
|
89
148
|
def read_from_request
|
data/lib/cuukie/views/index.erb
CHANGED
@@ -9,7 +9,9 @@
|
|
9
9
|
|
10
10
|
<body>
|
11
11
|
<div class="cucumber"><div id="cucumber-header"><div id="label"><h1>Cucumber Features</h1></div>
|
12
|
-
<div id="summary"
|
12
|
+
<div id="summary">
|
13
|
+
<p id="stats"></p>
|
14
|
+
<p id="duration"></p>
|
13
15
|
<div id="expand-collapse"><p id="expander">Expand All</p><p id="collapser">Collapse All</p></div>
|
14
16
|
</div>
|
15
17
|
</div>
|
@@ -35,6 +37,20 @@
|
|
35
37
|
<span class="keyword"><%= step['keyword'] %></span><span class="step val"><%= step['name'] %></span>
|
36
38
|
</div>
|
37
39
|
<div class="step_file"><span><%= step['file_colon_line'] %></span></div>
|
40
|
+
<% unless step['table'].empty? %>
|
41
|
+
<table>
|
42
|
+
<% step['table'].each_with_index do |rowdata, row| %>
|
43
|
+
<tr class='step' id='row_-<%= row %>'>
|
44
|
+
<% rowdata.each_with_index do |value, col| %>
|
45
|
+
<td class="step" id="row_-<%= row %>_<%= col %>"><div><span class="step param"><%= value %></span></div></td>
|
46
|
+
<% end %>
|
47
|
+
</tr>
|
48
|
+
<% end %>
|
49
|
+
</table>
|
50
|
+
<% end %>
|
51
|
+
<% if step['multiline_string'] %>
|
52
|
+
<pre class="val"><%= step['multiline_string'] %></pre>
|
53
|
+
<% end %>
|
38
54
|
</li>
|
39
55
|
<% end %>
|
40
56
|
</ol>
|
@@ -42,6 +58,12 @@
|
|
42
58
|
<% end %>
|
43
59
|
</div>
|
44
60
|
<% end %>
|
61
|
+
<script type="text/javascript">
|
62
|
+
document.getElementById('duration').innerHTML = "Finished in <strong><%= @duration %> seconds</strong>";
|
63
|
+
</script>
|
64
|
+
<script type="text/javascript">
|
65
|
+
document.getElementById('stats').innerHTML = "<%= @stats[:scenarios] %><br/><%= @stats[:steps] %>";
|
66
|
+
</script>
|
45
67
|
</div>
|
46
68
|
</body>
|
47
69
|
</html>
|
data/spec/commands_spec.rb
CHANGED
@@ -1,14 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
1
3
|
describe "The cuukie_server command" do
|
2
|
-
it "starts the Cuukie server" do
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
it "starts the Cuukie server on port 4569 by default" do
|
5
|
+
start_process "ruby bin/cuukie_server >/dev/null 2>&1"
|
6
|
+
wait_for_server_on_port 4569
|
7
|
+
stop_server_on_port 4569
|
8
|
+
end
|
9
|
+
|
10
|
+
it "starts the Cuukie server on any given port" do
|
11
|
+
start_process "ruby bin/cuukie_server 4570 >/dev/null 2>&1"
|
12
|
+
wait_for_server_on_port 4570
|
13
|
+
stop_server_on_port 4570
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "The cuukie formatter" do
|
18
|
+
require 'tempfile'
|
19
|
+
|
20
|
+
before :each do
|
21
|
+
@out = Tempfile.new('cuukie.tmp')
|
22
|
+
end
|
23
|
+
|
24
|
+
after :each do
|
25
|
+
@out.delete
|
26
|
+
end
|
27
|
+
|
28
|
+
it "expects a server on localhost:4569 by default" do
|
29
|
+
begin
|
30
|
+
start_process "ruby bin/cuukie_server 4569 >/dev/null 2>&1"
|
31
|
+
wait_for_server_on_port 4569
|
32
|
+
cmd = "cd spec/test_project && \
|
33
|
+
cucumber features/1_show_scenarios.feature:9 \
|
34
|
+
--format cuukie > #{@out.path}"
|
35
|
+
system(cmd).should be_true
|
36
|
+
@out.read.should == ''
|
37
|
+
ensure
|
38
|
+
stop_server_on_port 4569
|
9
39
|
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "can point to a different server" do
|
43
|
+
start_process "ruby bin/cuukie_server 4570 >/dev/null 2>&1"
|
10
44
|
begin
|
11
|
-
|
12
|
-
|
45
|
+
wait_for_server_on_port 4570
|
46
|
+
cmd = "cd spec/test_project && \
|
47
|
+
cucumber features/1_show_scenarios.feature:9 \
|
48
|
+
CUUKIE_SERVER=http://localhost:4570 \
|
49
|
+
--format cuukie > #{@out.path}"
|
50
|
+
system(cmd).should be_true
|
51
|
+
@out.read.should == ''
|
52
|
+
ensure
|
53
|
+
stop_server_on_port 4570
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it "fails gracefully if the server is down" do
|
58
|
+
cmd = "cd spec/test_project && \
|
59
|
+
cucumber features/1_show_scenarios.feature:9 \
|
60
|
+
CUUKIE_SERVER=http://some.server:4570 \
|
61
|
+
--format cuukie > #{@out.path}"
|
62
|
+
system(cmd).should be_true
|
63
|
+
@out.read.should match 'I cannot find the cuukie_server on http://some.server:4570'
|
13
64
|
end
|
14
65
|
end
|
data/spec/cuukie_spec.rb
CHANGED
@@ -1,26 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
1
3
|
describe 'Cuukie' do
|
2
4
|
before(:all) { start_server }
|
3
|
-
after(:all) {
|
5
|
+
after(:all) { stop_server_on_port 4569 }
|
4
6
|
|
5
|
-
describe '
|
7
|
+
describe 'shows suite result at the top of the page' do
|
6
8
|
it "contains essential information" do
|
7
9
|
run_cucumber
|
8
10
|
html.should match '<h1>Cucumber Features</h1>'
|
9
11
|
html.should match '<title>Cuukie</title>'
|
10
12
|
end
|
11
13
|
|
12
|
-
it "
|
13
|
-
run_cucumber '
|
14
|
+
it "shows green if all scenarios passed" do
|
15
|
+
run_cucumber '1_show_scenarios.feature:9'
|
14
16
|
html.should match /passedColors\('cucumber-header'\)/
|
15
17
|
end
|
16
18
|
|
17
|
-
it "
|
18
|
-
run_cucumber '
|
19
|
+
it "shows red if any scenario failed" do
|
20
|
+
run_cucumber '1_show_scenarios.feature'
|
19
21
|
html.should match /failedColors\('cucumber-header'\)/
|
20
22
|
end
|
21
23
|
|
22
|
-
it "
|
23
|
-
run_cucumber '
|
24
|
+
it "shows yellow if no scenarios failed but some are pending" do
|
25
|
+
run_cucumber '1_show_scenarios.feature:19'
|
24
26
|
html.should match /pendingColors\('cucumber-header'\)/
|
25
27
|
end
|
26
28
|
end
|
@@ -48,7 +50,7 @@ describe 'Cuukie' do
|
|
48
50
|
end
|
49
51
|
|
50
52
|
it "shows the scenario source position" do
|
51
|
-
html.should match '>features/
|
53
|
+
html.should match '>features/1_show_scenarios.feature:'
|
52
54
|
end
|
53
55
|
|
54
56
|
it "shows the passed scenarios in green" do
|
@@ -75,7 +77,7 @@ describe 'Cuukie' do
|
|
75
77
|
end
|
76
78
|
|
77
79
|
it "shows the step source position" do
|
78
|
-
html.should match '>features/step_definitions/example_steps.rb:
|
80
|
+
html.should match '>features/step_definitions/example_steps.rb:'
|
79
81
|
end
|
80
82
|
|
81
83
|
it "shows the step status" do
|
@@ -83,46 +85,27 @@ describe 'Cuukie' do
|
|
83
85
|
html.should match 'class="step pending"'
|
84
86
|
end
|
85
87
|
|
86
|
-
it "escapes
|
88
|
+
it "escapes HTML output" do
|
87
89
|
html.should match 'I pass an "argument"'
|
88
90
|
end
|
91
|
+
|
92
|
+
it "shows tables in steps" do
|
93
|
+
html.should match '<td class="step" id="row_-0_0"><div><span class="step param">x</span></div></td>'
|
94
|
+
html.should match '<td class="step" id="row_-2_1"><div><span class="step param">22</span></div></td>'
|
95
|
+
end
|
96
|
+
|
97
|
+
it "shows multiline strings in steps" do
|
98
|
+
html.should match '<pre class=\"val\"> Cuukie is sweet!\n Let's try it out.</pre>'
|
99
|
+
end
|
100
|
+
|
101
|
+
it "shows total duration" do
|
102
|
+
html.should match /Finished in <strong>\d+m\d+\.\d+s seconds<\/strong>/
|
103
|
+
end
|
104
|
+
|
105
|
+
it "shows end-of-features stats" do
|
106
|
+
run_cucumber '1_show_scenarios.feature'
|
107
|
+
html.should match /3 scenarios \(1 failed, 1 pending, 1 passed\)/
|
108
|
+
html.should match /11 steps \(1 failed, 2 skipped, 1 pending, 7 passed\)/
|
109
|
+
end
|
89
110
|
end
|
90
111
|
end
|
91
|
-
|
92
|
-
require 'rest-client'
|
93
|
-
|
94
|
-
[:GET, :POST, :PUT, :DELETE].each do |method|
|
95
|
-
Kernel.send :define_method, method do |*args|
|
96
|
-
args[0] = "http://localhost:4569#{args[0]}"
|
97
|
-
RestClient.send method.downcase, *args
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def start_server
|
102
|
-
Process.detach fork { exec "ruby bin/cuukie_server >/dev/null 2>&1" }
|
103
|
-
|
104
|
-
# wait until it's up
|
105
|
-
loop do
|
106
|
-
begin
|
107
|
-
GET '/ping'
|
108
|
-
return
|
109
|
-
rescue; end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def stop_server
|
114
|
-
# the server dies without replying, so we expect an error here
|
115
|
-
DELETE '/'
|
116
|
-
rescue
|
117
|
-
end
|
118
|
-
|
119
|
-
def html
|
120
|
-
GET('/').body
|
121
|
-
end
|
122
|
-
|
123
|
-
def run_cucumber(feature = '')
|
124
|
-
system "cd spec/test_project &&
|
125
|
-
cucumber features/#{feature} \
|
126
|
-
--format cuukie \
|
127
|
-
--guess"
|
128
|
-
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
|
3
|
+
def start_process(command)
|
4
|
+
Process.detach fork { exec command }
|
5
|
+
end
|
6
|
+
|
7
|
+
def run_cucumber(feature = '')
|
8
|
+
system "cd spec/test_project &&
|
9
|
+
cucumber features/#{feature} --format cuukie"
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rest-client'
|
13
|
+
|
14
|
+
[:GET, :POST, :PUT, :DELETE].each do |method|
|
15
|
+
Kernel.send :define_method, method do |*args|
|
16
|
+
args[0] = "http://localhost:4569#{args[0]}"
|
17
|
+
RestClient.send method.to_s.downcase, *args
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def start_server
|
22
|
+
start_process "ruby bin/cuukie_server >/dev/null 2>&1"
|
23
|
+
wait_for_server_on_port 4569
|
24
|
+
end
|
25
|
+
|
26
|
+
def wait_for_server_on_port(port)
|
27
|
+
loop do
|
28
|
+
begin
|
29
|
+
RestClient.get "http://localhost:#{port}/ping"
|
30
|
+
return
|
31
|
+
rescue; end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def stop_server_on_port(port)
|
36
|
+
# the server dies without replying, so we expect an error here
|
37
|
+
RestClient.delete "http://localhost:#{port}/"
|
38
|
+
rescue
|
39
|
+
end
|
40
|
+
|
41
|
+
def html
|
42
|
+
GET('/').body
|
43
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Feature:
|
2
|
+
As a Cuker
|
3
|
+
I want to see multiline arguments in the result
|
4
|
+
To see everything about steps
|
5
|
+
|
6
|
+
Scenario: Show tables
|
7
|
+
Given the following table
|
8
|
+
| x | y |
|
9
|
+
| 1 | 2 |
|
10
|
+
| 11 | 22 |
|
11
|
+
Then Cuukie should be OK with it
|
12
|
+
|
13
|
+
Scenario: Show tables
|
14
|
+
Given I say
|
15
|
+
"""
|
16
|
+
Cuukie is sweet!
|
17
|
+
Let's try it out.
|
18
|
+
"""
|
19
|
+
Then Cuukie should be OK with it
|
@@ -1,3 +1,6 @@
|
|
1
|
+
Given /^the following table$/ do |table|
|
2
|
+
end
|
3
|
+
|
1
4
|
When /^I pass an "([^"]*)"$/ do |argument|
|
2
5
|
end
|
3
6
|
|
@@ -9,4 +12,13 @@ When /I call a pending Step/ do
|
|
9
12
|
pending
|
10
13
|
end
|
11
14
|
|
12
|
-
Given
|
15
|
+
Given /^I execute a Background step$/ do; end
|
16
|
+
Given /^I do something$/ do; end
|
17
|
+
When /^I do something else$/ do; end
|
18
|
+
Then /^I should see stuff$/ do; end
|
19
|
+
Then /^the entire Scenario should pass$/ do; end
|
20
|
+
Then /^the entire Scenario should fail$/ do; end
|
21
|
+
Then /^the entire Scenario should be pending$/ do; end
|
22
|
+
Then /^the entire Scenario should be skipped anyway$/ do; end
|
23
|
+
Then /^Cuukie should be OK with it$/ do; end
|
24
|
+
Given /^I say$/ do |smart_stuff|; end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuukie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
16
|
-
requirement: &
|
16
|
+
requirement: &70255289550100 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70255289550100
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rest-client
|
27
|
-
requirement: &
|
27
|
+
requirement: &70255289549480 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70255289549480
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: cucumber
|
38
|
-
requirement: &
|
38
|
+
requirement: &70255289548840 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70255289548840
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &70255289548080 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70255289548080
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70255289547420 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70255289547420
|
69
69
|
description: Shows Cucumber results on a web page as they run.
|
70
70
|
email: paolo.nusco.perrotta@gmail.com
|
71
71
|
executables:
|
@@ -96,9 +96,11 @@ files:
|
|
96
96
|
- lib/test.rb
|
97
97
|
- spec/commands_spec.rb
|
98
98
|
- spec/cuukie_spec.rb
|
99
|
-
- spec/
|
99
|
+
- spec/spec_helper.rb
|
100
|
+
- spec/test_project/features/1_show_scenarios.feature
|
100
101
|
- spec/test_project/features/2_multiple_features.feature
|
101
102
|
- spec/test_project/features/3_failed_background.feature
|
103
|
+
- spec/test_project/features/4_show_multiline_args.feature
|
102
104
|
- spec/test_project/features/step_definitions/example_steps.rb
|
103
105
|
- spec/test_project/features/support/formatters.rb
|
104
106
|
homepage: http://github.com/nusco/cuukie
|
@@ -116,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
118
|
version: '0'
|
117
119
|
segments:
|
118
120
|
- 0
|
119
|
-
hash:
|
121
|
+
hash: -2321068096290706559
|
120
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
123
|
none: false
|
122
124
|
requirements:
|