gurke 1.0.1 → 2.0.0.dev.1.b17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/README.md +85 -38
- data/bin/gurke +5 -0
- data/features/gurke.feature +47 -0
- data/features/gurke.rb +12 -0
- data/features/gurke/backtrace_filtering.feature +36 -0
- data/features/gurke/filter_by_tags.feature +70 -0
- data/features/gurke/step_specific_definitions.feature +41 -0
- data/features/support/steps/cli_steps.rb +50 -0
- data/features/support/steps/file_steps.rb +32 -0
- data/gurke.gemspec +11 -7
- data/lib/gurke.rb +43 -16
- data/lib/gurke/background.rb +33 -0
- data/lib/gurke/builder.rb +107 -0
- data/lib/gurke/capybara.rb +28 -0
- data/lib/gurke/cli.rb +67 -0
- data/lib/gurke/configuration.rb +118 -0
- data/lib/gurke/dsl.rb +45 -0
- data/lib/gurke/feature.rb +55 -0
- data/lib/gurke/reporter.rb +98 -0
- data/lib/gurke/rspec.rb +5 -0
- data/lib/gurke/runner.rb +156 -0
- data/lib/gurke/scenario.rb +84 -0
- data/lib/gurke/step.rb +41 -0
- data/lib/gurke/step_definition.rb +31 -0
- data/lib/gurke/steps.rb +36 -0
- data/lib/gurke/tag.rb +41 -0
- data/lib/gurke/version.rb +14 -0
- metadata +59 -36
- data/.gitignore +0 -19
- data/Gemfile +0 -4
- data/Rakefile +0 -1
- data/lib/gurke/current.rb +0 -39
- data/lib/gurke/formatter.rb +0 -180
- data/lib/gurke/formatters/base.rb +0 -21
- data/lib/gurke/formatters/headless.rb +0 -108
- data/lib/gurke/hooks.rb +0 -42
- data/lib/gurke/patch/cucumber_cli_configuration.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDc3MWMyNWIzYzQ0MGRmMWFkMmIyMmFmMjYwMTgzN2I3NmQ0YTdmYQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ODQ4YWI3ZTUyZDhmYjk2YzQ2NWQwOWY1ZmM1YzFkNDQ5YWRhZTJjYQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OTcwMGYwOTM2NTEzNGQ0MWU0YmFiN2I3OWMxNjAxZTc4N2Q0OGEwYTdkOGY4
|
10
|
+
NDJkNmI0MjY0ZTYzYzcyMTVhNDZkYWY0MWE2MzVmYTc1ZjE1ZTMxYzZkMjQ2
|
11
|
+
OGU4ZTRmODkyZTQ2MWMzY2VjOTM0MWE5MTdhNWQwODdiYjEwZmQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MmUyOWRiZDQ3ZWYyMDU5ZGY0M2Y3ODk2MmIyYThjNGI2MGYzNTEyMTJiNzJl
|
14
|
+
ZTAzOGZlNzIwMGJmNGQzZDBlY2E5ZDBlZDk1ZDlhOWVlZDFhMzJiYjJjODJh
|
15
|
+
ZGNjMmU1OWFjOTdjMTkwNmFjNTE5ZDQ4NDI1MGViZTliNTA4ZjA=
|
data/README.md
CHANGED
@@ -1,74 +1,121 @@
|
|
1
1
|
# Gurke
|
2
2
|
|
3
|
-
**Gurke** is
|
3
|
+
**Gurke** is an experimental, alternative cucumber runner. It ~~steals~~ borrows ideas and concepts from [turnip](https://github.com/jnicklas/turnip), [rspec](http://rspec.info) and tries to avoid [cucumber](https://github.com/cucumber/cucumber/).
|
4
4
|
|
5
|
-
|
5
|
+
That includes * Step definitions in modules * Before, After and Around hooks * Formatters * Partial step inclusion (via modules) * etc. Also new ideas like keyword depended step definitions are planned.
|
6
|
+
|
7
|
+
But still **Gurke** is unfinished, not recommended and highly dangerous!
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
9
|
-
|
11
|
+
Or install it yourself as:
|
12
|
+
|
13
|
+
$ gem install gurke
|
10
14
|
|
11
|
-
|
15
|
+
Or add it to your `Gemfile` and install it using bundler.
|
12
16
|
|
13
|
-
|
17
|
+
## Usage
|
14
18
|
|
15
|
-
|
19
|
+
1. Put features in `features/`.
|
16
20
|
|
17
|
-
|
21
|
+
2. Put support and configuration files as ruby into `features/support/**`.
|
18
22
|
|
19
|
-
|
23
|
+
e.g.
|
20
24
|
|
21
|
-
|
25
|
+
```ruby
|
26
|
+
# features/support/gurke.rb
|
27
|
+
require 'gurke/rspec'
|
28
|
+
require 'tmpdir'
|
22
29
|
|
30
|
+
Gurke.configure do |c|
|
31
|
+
c.around(:scenario) do |scenario|
|
32
|
+
Dir.mktmpdir('gurke') do |dir|
|
33
|
+
@__root = Pathname.new(dir)
|
34
|
+
scenario.call
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
23
38
|
```
|
24
|
-
require 'gurke'
|
25
39
|
|
26
|
-
|
27
|
-
require 'cucumber/formatter/junit'
|
28
|
-
require 'gurke/formatters/headless'
|
40
|
+
3. Put your step definitions into `features/support/**`.
|
29
41
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
42
|
+
```ruby
|
43
|
+
# features/support/steps/file_steps.rb
|
44
|
+
module FileSteps
|
45
|
+
step(/a file "(.*?)" with the following content exists/) do |path, step|
|
46
|
+
file = @__root.join(path)
|
34
47
|
|
35
|
-
|
36
|
-
|
48
|
+
FileUtils.mkdir_p(File.dirname(file))
|
49
|
+
File.write(file, step.doc_string)
|
37
50
|
end
|
38
51
|
end
|
39
52
|
|
40
|
-
Gurke
|
41
|
-
use Cucumber::Formatter::Pretty
|
42
|
-
use Cucumber::Formatter::JUnit
|
43
|
-
use MyExternalTool, quiet: true
|
44
|
-
use Gurke::Formatters::Headless, dir: 'report/html', recording: true, record_all: true
|
45
|
-
end
|
53
|
+
Gurke.configure{|c| c.include FileSteps }
|
46
54
|
```
|
47
55
|
|
48
|
-
|
49
|
-
Gurke.current.step
|
50
|
-
Gurke.current.scenario
|
56
|
+
You can also use an existing method as a step:
|
51
57
|
|
52
|
-
|
53
|
-
|
54
|
-
|
58
|
+
```ruby
|
59
|
+
module MySteps
|
60
|
+
def do_something(arg)
|
61
|
+
# ...
|
62
|
+
end
|
55
63
|
|
56
|
-
|
57
|
-
|
64
|
+
step(/I do something: "(.*?)"/, :do_something)
|
65
|
+
|
66
|
+
# Easy call it from another step
|
67
|
+
step(/I do something else/) { do_something('abc') }
|
58
68
|
end
|
69
|
+
```
|
70
|
+
|
71
|
+
### Keyword specific step definitions
|
72
|
+
|
73
|
+
You can also define steps for only a specific keyword. This also allows you to use the same step pattern for different keywords, e.g.
|
59
74
|
|
60
|
-
|
61
|
-
|
75
|
+
```ruby
|
76
|
+
module PathSteps
|
77
|
+
Given(/^I am on the start page$/) { visit '/' }
|
78
|
+
Then(/^I am on the start page$/) { assert current_path == '/' }
|
62
79
|
end
|
80
|
+
```
|
63
81
|
|
64
|
-
|
82
|
+
Therefore you can write your scenarios in a documentary style of facts:
|
65
83
|
|
66
84
|
```
|
85
|
+
Scenario: Use the back button
|
86
|
+
Given I am on the start page
|
87
|
+
When I click on "Go to another page"
|
88
|
+
And I click the back button
|
89
|
+
Then I am on the start page
|
90
|
+
```
|
91
|
+
|
92
|
+
`And` and `But` steps will inherit the keyword type from the step before, e.g. the `And` step above will be of the `when` type.
|
93
|
+
|
94
|
+
### Use the command line runner
|
95
|
+
|
96
|
+
Run all scenarios by just calling `bundle exec gurke`. By default scenarios and features tagged with `@wip` will be ignored.
|
97
|
+
|
98
|
+
Specify one or more `--tags` or `-t` arguments to filter for specific tags, negate tag filters with `~`.
|
99
|
+
|
100
|
+
Examples:
|
101
|
+
|
102
|
+
* `--tags a,b` - only run scenarios with tags `@a` AND `@b`
|
103
|
+
* `-t a -t b` - only run scenarios with tags `@a` OR `@b`
|
104
|
+
* `-t a,~b` - only run scenarios with `@a` but not `@b`
|
67
105
|
|
68
106
|
## TODO
|
69
107
|
|
70
|
-
*
|
108
|
+
* Random run order (rspec)
|
109
|
+
* Using strings with placeholders as step pattern (turnip)
|
110
|
+
* Custom placeholders (turnip)
|
111
|
+
* Define scenario specific after hook in a step (e.g. to close opened resource)
|
112
|
+
* More reporters (NyanCat / JUnit / TeamCity / Adapter to run multiple reporters)
|
113
|
+
* SimpleCov support (and use it in own tests)
|
114
|
+
|
115
|
+
## History
|
116
|
+
|
117
|
+
Now: * Can finally (start to) test itself.
|
71
118
|
|
72
119
|
## Contributing
|
73
120
|
|
74
|
-
|
121
|
+
Send me code.
|
data/bin/gurke
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
Feature: Use gurke
|
2
|
+
As a developer
|
3
|
+
In order to run my feature definitions
|
4
|
+
I want to use the gurke command line program
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I am in a project using gurke
|
8
|
+
|
9
|
+
Scenario: Run a passing feature file
|
10
|
+
Given a file "features/test.feature" with the following content exists
|
11
|
+
"""
|
12
|
+
Feature: F
|
13
|
+
Scenario: Scenario A
|
14
|
+
Given everything is ok
|
15
|
+
"""
|
16
|
+
And a file "features/support/steps/test_steps.rb" with the following content exists
|
17
|
+
"""
|
18
|
+
module TestSteps
|
19
|
+
step("everything is ok") { }
|
20
|
+
end
|
21
|
+
Gurke.configure{|c| c.include TestSteps }
|
22
|
+
"""
|
23
|
+
When I execute "bundle exec gurke"
|
24
|
+
Then the program exit code should be null
|
25
|
+
And the program output should include "Feature: F"
|
26
|
+
And the program output should include "Scenario: Scenario A"
|
27
|
+
And the program output should include "Given everything is ok"
|
28
|
+
And the program output should include "1 scenarios: 0 failing, 0 pending"
|
29
|
+
|
30
|
+
Scenario: Run a failing feature file
|
31
|
+
Given a file "features/test.feature" with the following content exists
|
32
|
+
"""
|
33
|
+
Feature: F
|
34
|
+
Scenario: Scenario A
|
35
|
+
Given nothing is ok
|
36
|
+
|
37
|
+
"""
|
38
|
+
And a file "features/support/steps/test_steps.rb" with the following content exists
|
39
|
+
"""
|
40
|
+
module TestSteps
|
41
|
+
step("nothing is ok") { raise RuntimeError }
|
42
|
+
end
|
43
|
+
Gurke.configure{|c| c.include TestSteps }
|
44
|
+
"""
|
45
|
+
When I execute "bundle exec gurke"
|
46
|
+
And the program output should include "1 scenarios: 1 failing, 0 pending"
|
47
|
+
Then the program exit code should be non-null
|
data/features/gurke.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
Feature: Backtrace filtering
|
2
|
+
As a developer
|
3
|
+
In order to faster find the backtrace lines
|
4
|
+
I want to see modified backtraces with only non-library calls
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I am in a project using gurke
|
8
|
+
And a file "features/test.feature" with the following content exists
|
9
|
+
"""
|
10
|
+
Feature: F
|
11
|
+
Scenario: Scenario A
|
12
|
+
Given there is an error
|
13
|
+
|
14
|
+
"""
|
15
|
+
And a file "features/support/steps/test_steps.rb" with the following content exists
|
16
|
+
"""
|
17
|
+
module TestSteps
|
18
|
+
step("there is an error") { raise RuntimeError }
|
19
|
+
end
|
20
|
+
Gurke.configure{|c| c.include TestSteps }
|
21
|
+
"""
|
22
|
+
|
23
|
+
Scenario: See backtrace without line from libraries
|
24
|
+
When I execute "bundle exec gurke"
|
25
|
+
Then the program output should include "features/support/steps/test_steps.rb:2"
|
26
|
+
Then the program output should not include "gurke/lib/gurke/runner.rb"
|
27
|
+
|
28
|
+
Scenario: See backtrace when run with --backtrace
|
29
|
+
When I execute "bundle exec gurke --backtrace"
|
30
|
+
Then the program output should include "features/support/steps/test_steps.rb:2"
|
31
|
+
Then the program output should include "gurke/lib/gurke/runner.rb"
|
32
|
+
|
33
|
+
Scenario: See backtrace when run with -b
|
34
|
+
When I execute "bundle exec gurke -b"
|
35
|
+
Then the program output should include "features/support/steps/test_steps.rb:2"
|
36
|
+
Then the program output should include "gurke/lib/gurke/runner.rb"
|
@@ -0,0 +1,70 @@
|
|
1
|
+
Feature: Backtrace filtering
|
2
|
+
In order to not always run every fukcin long scenario
|
3
|
+
As a tester
|
4
|
+
I want to filter features and scenarios by tags to only run a subset
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I am in a project using gurke
|
8
|
+
And a file "features/support/steps/test_steps.rb" with the following content exists
|
9
|
+
"""
|
10
|
+
module TestSteps
|
11
|
+
step("everything's ok") { true && true }
|
12
|
+
end
|
13
|
+
Gurke.configure{|c| c.include TestSteps }
|
14
|
+
"""
|
15
|
+
And a file "features/feature_flag_a.feature" with the following content exists
|
16
|
+
"""
|
17
|
+
@a @c @d
|
18
|
+
Feature: Feature Flagged little-A
|
19
|
+
Scenario: Best Scenario evvvarrr
|
20
|
+
Then everything's ok
|
21
|
+
"""
|
22
|
+
And a file "features/feature_flag_b.feature" with the following content exists
|
23
|
+
"""
|
24
|
+
@b @c @d
|
25
|
+
Feature: Feature Flagged little-B
|
26
|
+
Scenario: Best Scenario evvvarr, the second
|
27
|
+
Then everything's ok
|
28
|
+
"""
|
29
|
+
And a file "features/feature_flag_wip.feature" with the following content exists
|
30
|
+
"""
|
31
|
+
@wip
|
32
|
+
Feature: Feature Flagged little-WIP
|
33
|
+
Scenario: Best Scenario evvarr, the second
|
34
|
+
Then everything's ok
|
35
|
+
"""
|
36
|
+
|
37
|
+
Scenario: Do not run @wip by default
|
38
|
+
When I execute "bundle exec gurke"
|
39
|
+
Then the program output should include "Feature Flagged little-A"
|
40
|
+
And the program output should include "Feature Flagged little-B"
|
41
|
+
And the program output should not include "Feature Flagged little-WIP"
|
42
|
+
And the program output should include "2 scenarios"
|
43
|
+
|
44
|
+
Scenario: Filter with positive tag match
|
45
|
+
When I execute "bundle exec gurke --tags a"
|
46
|
+
Then the program output should include "Feature Flagged little-A"
|
47
|
+
And the program output should not include "Feature Flagged little-B"
|
48
|
+
And the program output should not include "Feature Flagged little-WIP"
|
49
|
+
And the program output should include "1 scenarios"
|
50
|
+
|
51
|
+
Scenario: Filter with negative tag match
|
52
|
+
When I execute "bundle exec gurke -t ~b"
|
53
|
+
Then the program output should include "Feature Flagged little-A"
|
54
|
+
And the program output should not include "Feature Flagged little-B"
|
55
|
+
And the program output should include "Feature Flagged little-WIP"
|
56
|
+
And the program output should include "2 scenarios"
|
57
|
+
|
58
|
+
Scenario: Filter with multiple tag match and'ed
|
59
|
+
When I execute "bundle exec gurke --tags c,d"
|
60
|
+
Then the program output should include "Feature Flagged little-A"
|
61
|
+
And the program output should include "Feature Flagged little-B"
|
62
|
+
And the program output should not include "Feature Flagged little-WIP"
|
63
|
+
And the program output should include "2 scenarios"
|
64
|
+
|
65
|
+
Scenario: Filter with multiple tag match or'ed
|
66
|
+
When I execute "bundle exec gurke --tags b --tags wip"
|
67
|
+
Then the program output should not include "Feature Flagged little-A"
|
68
|
+
And the program output should include "Feature Flagged little-B"
|
69
|
+
And the program output should include "Feature Flagged little-WIP"
|
70
|
+
And the program output should include "2 scenarios"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: Step keyword specific definitions
|
2
|
+
In order to allow documentary style scenarios
|
3
|
+
As a user
|
4
|
+
I want to define same steps with different step keywords
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I am in a project using gurke
|
8
|
+
|
9
|
+
Scenario: Use same step definition with different keyword
|
10
|
+
Given a file "features/test.feature" with the following content exists
|
11
|
+
"""
|
12
|
+
Feature: F
|
13
|
+
Scenario: Scenario A
|
14
|
+
Given I am "John"
|
15
|
+
When I am "John"
|
16
|
+
Then I am "John"
|
17
|
+
|
18
|
+
"""
|
19
|
+
And a file "features/support/steps/test_steps.rb" with the following content exists
|
20
|
+
"""
|
21
|
+
require 'test/unit/assertions'
|
22
|
+
|
23
|
+
module Steps
|
24
|
+
include MiniTest::Assertions
|
25
|
+
|
26
|
+
Given(/^I am "(.+)"$/) do |name|
|
27
|
+
@me = name
|
28
|
+
end
|
29
|
+
|
30
|
+
When(/^I am "(.+)"$/) do |name|
|
31
|
+
@copy = @me
|
32
|
+
end
|
33
|
+
|
34
|
+
Then(/^I am "(.+)"$/) do |name|
|
35
|
+
assert name == @copy, "Expected #{name.inspect} but #{@me.inspect} given."
|
36
|
+
end
|
37
|
+
end
|
38
|
+
Gurke.world.send :include, Steps
|
39
|
+
"""
|
40
|
+
When I execute all scenarios
|
41
|
+
Then all scenarios have passed
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
3
|
+
#
|
4
|
+
module CLISteps
|
5
|
+
def _execute(exec)
|
6
|
+
Dir.chdir(@__root) do
|
7
|
+
Bundler.with_clean_env do
|
8
|
+
Open3.popen2e(exec) do |_, stdout_err, wait_thr|
|
9
|
+
exit_status = wait_thr.value
|
10
|
+
stdout_err = stdout_err.read
|
11
|
+
|
12
|
+
@last_process = [exit_status.to_i, stdout_err]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
step(/I execute "(.*?)"/, :_execute)
|
19
|
+
|
20
|
+
step('I execute all scenarios') do
|
21
|
+
_execute 'bundle exec gurke'
|
22
|
+
end
|
23
|
+
|
24
|
+
step(/the program exit code should be null/) do
|
25
|
+
expect(@last_process[0]).to eq 0
|
26
|
+
end
|
27
|
+
|
28
|
+
step(/the program exit code should be non-null/) do
|
29
|
+
expect(@last_process[0]).to_not eq 0
|
30
|
+
end
|
31
|
+
|
32
|
+
def _cli_include_content(content)
|
33
|
+
expect(@last_process[1]).to include content
|
34
|
+
end
|
35
|
+
|
36
|
+
step(/the program output should include "(.*?)"/, :_cli_include_content)
|
37
|
+
|
38
|
+
def _cli_not_include_content(content)
|
39
|
+
expect(@last_process[1]).to_not include content
|
40
|
+
end
|
41
|
+
|
42
|
+
step(/the program output should not include "(.*?)"/,
|
43
|
+
:_cli_not_include_content)
|
44
|
+
|
45
|
+
step(/all scenarios have passed/) do
|
46
|
+
_cli_include_content 'scenarios: 0 failing, 0 pending'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
Gurke.configure{|c| c.include CLISteps }
|