diff options
Diffstat (limited to 'subplot.md')
-rw-r--r-- | subplot.md | 59 |
1 files changed, 59 insertions, 0 deletions
@@ -503,8 +503,12 @@ then bar was done function: precond_foo - when: I do bar function: do_bar +- when: I do foobar + function: do_foobar - then: bar was done function: bar_was_done +- then: foobar was done + function: foobar_was_done ~~~ ### Python functions (f.py) @@ -512,10 +516,15 @@ then bar was done ~~~{.file #f.py .python .numberLines} def precond_foo(ctx): ctx['bar_done'] = False + ctx['foobar_done'] = False def do_bar(ctx): ctx['bar_done'] = True def bar_was_done(ctx): assert_eq(ctx['bar_done'], True) +def do_foobar(ctx): + ctx['foobar_done'] = True +def foobar_was_done(ctx): + assert_eq(ctx['foobar_done'], True) ~~~ @@ -544,6 +553,56 @@ then program finished successfully ~~~ +Keywords +----------------------------------------------------------------------------- + +Subplot supports the keywords **given**, **when**, and **then**, and +the aliases **and** and **but**. The aliases stand for the same +(effective) keyword as the previous step in the scenario. This chapter +has scenarios to check the keywords and aliases in various +combinations. + +### All the keywords + +~~~scenario +given file allkeywords.md +given file b.yaml +given file f.py +when I run sp-docgen allkeywords.md -o foo.pdf +then file foo.pdf exists +when I run sp-codegen --run allkeywords.md -o test.py +then scenario "All keywords" was run +then step "given precondition foo" was run +then step "when I do bar" was run +then step "then bar was done" was run +then program finished successfully +~~~ + +~~~{.file #allkeywords.md .markdown .numberLines} +--- +title: All the keywords scenario +bindings: b.yaml +functions: f.py +... + +# All keywords + +This uses all the keywords. + +```scenario +given precondition foo +when I do bar +and I do foobar +then bar was done +but foobar was done +``` +~~~ + + +### Repeated keywords + +### + Empty lines in scenarios ----------------------------------------------------------------------------- |