Test example params are rendered where necessary: * Step names * Docstring * Datatables
(pytester)
| 200 | |
| 201 | |
| 202 | def test_example_params(pytester): |
| 203 | """Test example params are rendered where necessary: |
| 204 | * Step names |
| 205 | * Docstring |
| 206 | * Datatables |
| 207 | """ |
| 208 | pytester.makefile( |
| 209 | ".feature", |
| 210 | example_params=''' |
| 211 | Feature: Example params |
| 212 | Background: |
| 213 | Given I have a background <background> |
| 214 | And my background has: |
| 215 | """ |
| 216 | Background <background> |
| 217 | """ |
| 218 | |
| 219 | Scenario Outline: Outlined scenario |
| 220 | Given I have a templated <foo> |
| 221 | When I have a templated datatable |
| 222 | | <data> | |
| 223 | | example | |
| 224 | And I have a templated docstring |
| 225 | """ |
| 226 | This is a <doc> |
| 227 | """ |
| 228 | Then pass |
| 229 | |
| 230 | Examples: |
| 231 | | background | foo | data | doc | |
| 232 | | parameter | bar | table | string | |
| 233 | ''', |
| 234 | ) |
| 235 | pytester.makepyfile( |
| 236 | """ |
| 237 | from pytest_bdd import scenarios, given, when, then, parsers |
| 238 | from pytest_bdd.utils import dump_obj |
| 239 | |
| 240 | scenarios("example_params.feature") |
| 241 | |
| 242 | |
| 243 | @given(parsers.parse("I have a background {background}")) |
| 244 | def _(background): |
| 245 | return dump_obj(("background", background)) |
| 246 | |
| 247 | |
| 248 | @given(parsers.parse("I have a templated {foo}")) |
| 249 | def _(foo): |
| 250 | return "foo" |
| 251 | |
| 252 | |
| 253 | @given("my background has:") |
| 254 | def _(docstring): |
| 255 | return dump_obj(("background_docstring", docstring)) |
| 256 | |
| 257 | |
| 258 | @given("I have a rule table:") |
| 259 | def _(datatable): |
nothing calls this directly
no test coverage detected
searching dependent graphs…