-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbasic_steps_for_testing.feature
More file actions
108 lines (91 loc) · 3.08 KB
/
Copy pathbasic_steps_for_testing.feature
File metadata and controls
108 lines (91 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
Feature: Basic steps for testing
In order to test a context used to test Behat
As a Behat extension developer
I want to run Behat while running Behat
Background:
Given a context file "features/bootstrap/FeatureContext.php" containing:
"""
<?php
use Behat\Behat\Context\Context;
class FeatureContext implements Context
{
/**
* @Then it passes
*/
public function itPasses() {}
/**
* @Then it fails
*/
public function itFails() { throw new \RuntimeException(); }
/**
* @Then it passes with output :output
*/
public function itPassesWithOutput($output) { echo $output; }
/**
* @Then it fails with output :output
*/
public function itFailsWithOutput($output) { throw new \RuntimeException($output); }
}
"""
Scenario: Passing scenario
Given a feature file "features/passing_scenario.feature" containing:
"""
Feature: Passing feature
Scenario: Passing scenario
Then it passes
"""
When I run Behat
Then it should pass
Scenario: Passing scenario with output
Given a feature file "features/passing_scenario_with_output.feature" containing:
"""
Feature: Passing feature with output
Scenario: Passing scenario with output
Then it passes with output "Krzysztof Krawczyk"
"""
When I run Behat
Then it should pass with "Krzysztof Krawczyk"
Then it should pass with:
"""
Krzysztof Krawczyk
"""
Scenario: Failing scenario
Given a feature file "features/failing_scenario.feature" containing:
"""
Feature: Failing feature
Scenario: Failing scenario
Then it fails
"""
When I run Behat
Then it should fail
Scenario: Failing scenario with output
Given a feature file "features/failing_scenario_with_output.feature" containing:
"""
Feature: Failing feature with output
Scenario: Failing scenario with output
Then it fails with output "Krzysztof Krawczyk"
"""
When I run Behat
Then it should fail with "Krzysztof Krawczyk"
Then it should fail with:
"""
Krzysztof Krawczyk
"""
Scenario: Passing scenario without specifying its path
Given a feature file containing:
"""
Feature: Passing feature
Scenario: Passing scenario
Then it passes
"""
When I run Behat
Then it should pass
Scenario: Failing Behat due to its configuration
Given a Behat configuration containing:
"""
default:
extensions:
Unknown\Extension: ~
"""
When I run Behat
Then it should fail with "Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException"