Skip to content

Commit 3c95a8b

Browse files
committed
add POC for behave
Check that we can test Fix with behave using pexpect
1 parent 48fb918 commit 3c95a8b

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

behave/hello.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Feature: starting Fix (behave initial setup)
2+
3+
Scenario: run the simple Hello World app that Fix is today
4+
Given nothing
5+
When we run Fix
6+
Then it prints "Hello, fix!" and terminates

behave/steps/hello.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from behave import given, when, then
2+
import pexpect
3+
4+
fix_executable = '../cmake-build-debug/bin/fix'
5+
6+
7+
@given(u'nothing')
8+
def nothing(context):
9+
pass
10+
11+
12+
@when(u'we run Fix')
13+
def start_fix(context):
14+
context.fix = pexpect.spawn(fix_executable)
15+
16+
17+
@then(u'it prints "{expected_output}" and terminates')
18+
def check_output(context, expected_output):
19+
fix = context.fix
20+
fix.expect_exact(expected_output)
21+
assert (fix.wait() == 0)

0 commit comments

Comments
 (0)