summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fable-arch.md157
1 files changed, 144 insertions, 13 deletions
diff --git a/fable-arch.md b/fable-arch.md
index 4070b52..686524a 100644
--- a/fable-arch.md
+++ b/fable-arch.md
@@ -486,11 +486,61 @@ def was_done(ctx):
assert state['done']
```
+## A scenario step fails
+
+This tests that Fable can run handle a scenario step failing.
+
+```fable
+given files fail.md, fail.yaml, and fail.py
+when I run ftt-codegen --run fail.md
+
+then log file says scenario "Fail" was run
+and log file says step "given precondition foo" was run
+and log file says step "then bar was done" failed
+and program finished with an error
+```
+
+### fail.md—markdown file
+
+~~~~{#fail.md .markdown}
+# Fail
+This is a scenario that fails.
+
+```fable
+given precondition foo
+then bar was done
+```
+~~~~
+
+### fail.md—bindings file
+
+```{#fail.yaml .yaml}
+- given: precondition foo
+ function: precond
+- then: bar was done
+ function: was_done
+```
+
+### fail.md—Python file with functions
+
+```{#fail.py .python}
+state = {'done': False}
+def precond(ctx):
+ pass
+def do(ctx):
+ state['done'] = True
+def was_done(ctx):
+ assert state['done']
+```
+
## Two scenarios in the same markdown file
This tests that Fable can run two successful scenarios in the same
Markdown file successfully.
+FIXME: This and all other tests that run more than one scenario should
+handle scenarios being run in random order, and concurrently.
+
```fable
given files two.md, two.yaml, and two.py
when I run ftt-codegen --run two.md
@@ -553,25 +603,42 @@ def was_done(ctx):
assert state['done']
```
-## A scenario step fails
-This tests that Fable can run handle a scenario step failing.
+## Two scenarios, one has a failing step
+
+This tests that Fable runs both scenarios, even if one has a failing
+step.
```fable
-given files fail.md, fail.yaml, and fail.py
-when I run ftt-codegen --run fail.md
+given files onefails.md, onefails.yaml, and onefails.py
+when I run ftt-codegen --run onefails.md
-then log file says scenario "Fail" was run
+then log file says scenario "First" was run
+and log file says step "given precondition foo" was run
+and log file says step "when I do bar" was run
+and log file says step "then bar was done" was run
+
+then log file says scenario "Second" was run
and log file says step "given precondition foo" was run
and log file says step "then bar was done" failed
+
and program finished with an error
```
-### fail.md—markdown file
+### onefails.md—markdown file
-~~~~{#fail.md .markdown}
-# Fail
-This is a scenario that fails.
+~~~~{#onefails.md .markdown}
+# First
+This is the simplest possible test scenario
+
+```fable
+given precondition foo
+when I do bar
+then bar was done
+```
+
+# Second
+This is another scenario. This fails.
```fable
given precondition foo
@@ -579,18 +646,20 @@ then bar was done
```
~~~~
-### fail.md—bindings file
+### onefails.yaml—bindings file
-```{#fail.yaml .yaml}
+```{#two.yaml .yaml}
- given: precondition foo
function: precond
+- when: I do bar
+ function: do
- then: bar was done
function: was_done
```
-### fail.md—Python file with functions
+### onefails.md—Python file with functions
-```{#fail.py .python}
+```{#two.py .python}
state = {'done': False}
def precond(ctx):
pass
@@ -600,3 +669,65 @@ def was_done(ctx):
assert state['done']
```
+## Two scenarios, both have a failing step
+
+This tests that Fable runs both scenarios, even when both have a
+failing step.
+
+```fable
+given files twofail.md, twofail.yaml, and twofail.py
+when I run ftt-codegen --run twofail.md
+
+then log file says scenario "First" was run
+and log file says step "given precondition foo" was run
+and log file says step "then bar was done" failed
+
+then log file says scenario "Second" was run
+and log file says step "given precondition foo" was run
+and log file says step "then bar was done" failed
+
+and program finished with an error
+```
+
+### twofail.md—markdown file
+
+~~~~{#twofail.md .markdown}
+# First
+This is a failing scenario.
+
+```fable
+given precondition foo
+then bar was done
+```
+
+# Second
+This is another scenario. This fails.
+
+```fable
+given precondition foo
+then bar was done
+```
+~~~~
+
+### twofail.yaml—bindings file
+
+```{#twofail.yaml .yaml}
+- given: precondition foo
+ function: precond
+- when: I do bar
+ function: do
+- then: bar was done
+ function: was_done
+```
+
+### twofail.md—Python file with functions
+
+```{#twofail.py .python}
+state = {'done': False}
+def precond(ctx):
+ pass
+def do(ctx):
+ state['done'] = True
+def was_done(ctx):
+ assert state['done']
+```