Skip to content

Commit becca9c

Browse files
committed
Add exploratory test feature aborted
Run with: radish -b radish features --junit-xml=result.xml Produces junit xml: ``` <?xml version='1.0' encoding='utf-8'?> <testsuites time="0.000"> <testsuite name="Test summing numbers" failures="0" errors="0" skipped="1" tests="2" time="0.000"> <testcase classname="Test summing numbers" name="Sum two numbers" time="0.000"/> <testcase classname="Test summing numbers" name="Sum three numbers" time="0.000"> <skipped/> </testcase> </testsuite> <testsuite name="Test summing numbers" failures="0" errors="0" skipped="2" tests="2" time="0.000"> <testcase classname="Test summing numbers" name="Sum two numbers" time="0.000"> <skipped/> </testcase> <testcase classname="Test summing numbers" name="Sum three numbers" time="0.000"> <skipped/> </testcase> </testsuite> </testsuites> ```
1 parent dd494bf commit becca9c

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Feature: Test summing numbers
2+
In order to test the basic
3+
features of radish I test
4+
to sum numbers.
5+
6+
Scenario: Sum two numbers
7+
Given I have the number 5
8+
And I have the number 3
9+
When I sum them
10+
Then I expect the result to be 8
11+
12+
Scenario: Sum three numbers
13+
Given I have the number 5
14+
And I have the number 3
15+
And I have the number 2
16+
When I sum them
17+
Then I expect the result to be 10
18+
Then I crash
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Feature: Test summing numbers
2+
In order to test the basic
3+
features of radish I test
4+
to sum numbers.
5+
6+
Scenario: Sum two numbers
7+
Given I have the number 5
8+
And I have the number 3
9+
When I sum them
10+
Then I expect the result to be 8
11+
12+
Scenario: Sum three numbers
13+
Given I have the number 5
14+
And I have the number 3
15+
And I have the number 2
16+
When I sum them
17+
Then I expect the result to be 10
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import sys
2+
3+
from radish import then, when
4+
from radish.stepregistry import step
5+
6+
7+
@step("I have the number {number:g}")
8+
def have_number(step, number):
9+
step.context.numbers.append(int(number))
10+
11+
12+
@when("I sum them")
13+
def sum_numbers(step):
14+
step.context.result = sum(step.context.numbers)
15+
16+
17+
@then("I expect the result to be {result:g}")
18+
def expect_result(step, result):
19+
assert step.context.result == result
20+
21+
22+
@then("I crash")
23+
def crash(step):
24+
sys.exit(1)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from radish import before
2+
3+
4+
@before.each_scenario
5+
def init_numbers(scenario):
6+
scenario.context.numbers = []

0 commit comments

Comments
 (0)