This repository has been archived by the owner on Mar 1, 2019. It is now read-only.
forked from cucumber/aruba
-
Notifications
You must be signed in to change notification settings - Fork 1
/
stdout.feature
109 lines (97 loc) · 2.93 KB
/
stdout.feature
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
Feature: STDOUT of commands which were executed
In order to specify expected output
As a developer using Cucumber
I want to use the "the stdout should contain" step
Background:
Given I use a fixture named "cli-app"
Scenario: Match output in stdout
Given an executable named "bin/aruba-test-cli" with:
"""bash
#!/usr/bin/env bash
echo -e "hello\nworld"
"""
And a file named "features/output.feature" with:
"""cucumber
Feature: Run command
Scenario: Run command
When I run `cli`
Then the stdout should contain "hello"
Then the stderr should not contain "hello"
"""
When I run `cucumber`
Then the features should all pass
Scenario: Match stdout on several lines
Given an executable named "bin/aruba-test-cli" with:
"""bash
#!/usr/bin/env bash
echo 'GET /'
"""
And a file named "features/output.feature" with:
"""cucumber
Feature: Run command
Scenario: Run command
When I run `cli`
Then the stdout should contain:
\"\"\"
GET /
\"\"\"
"""
When I run `cucumber`
Then the features should all pass
Scenario: Match output on several lines where stdout contains quotes
Given an executable named "bin/aruba-test-cli" with:
"""bash
#!/usr/bin/env bash
echo 'GET "/"'
"""
And a file named "features/output.feature" with:
"""cucumber
Feature: Run command
Scenario: Run command
When I run `cli`
Then the stdout should contain:
\"\"\"
GET "/"
\"\"\"
"""
When I run `cucumber`
Then the features should all pass
Scenario: Detect stdout from all processes including interactive ones
Given a file named "features/output.feature" with:
"""
Feature: Run command
Scenario: Run command
When I run `printf "hello world!\n"`
And I run `cat` interactively
And I type "hola"
And I type ""
Then the stdout should contain:
\"\"\"
hello world!
\"\"\"
And the stdout should contain:
\"\"\"
hola
\"\"\"
And the stderr should not contain anything
"""
When I run `cucumber`
Then the features should all pass
Scenario: Detect stdout from named source
Given a file named "features/output.feature" with:
"""
Feature: Run command
Scenario: Run command
When I run `printf 'hello'`
And I run `printf 'goodbye'`
Then the stdout from "printf 'hello'" should contain "hello"
And the stdout from "printf 'hello'" should contain exactly "hello"
And the stdout from "printf 'hello'" should contain exactly:
\"\"\"
hello
\"\"\"
And the stderr from "printf 'hello'" should not contain "hello"
And the stdout from "printf 'goodbye'" should not contain "hello"
"""
When I run `cucumber`
Then the features should all pass