Does @data:orders load the dataset, or do I still need the Given step?
Asked 5,930 views1 answer
15votes
Tagged a scenario @data:orders on the assumption that it would put the columns in scope the way @user:standard puts an account in scope. The scenario runs, lint is clean, and the assertion fails with the placeholder still in it:
text
Expected to see the text "{{orderId}}"
So it clearly did not load. Is the tag broken, is it doing something else, or did I invent the behaviour?
You invented the behaviour, but it was a reasonable guess because the two tags look symmetrical and are not.
@user:<role> has a run-time effect: it leases an account before the browser context is created so the scenario starts logged in. @data:<dataset> is a fact about the scenario, not an instruction — lint validates that the dataset exists in data.sources, and that is the whole of it. Nothing is loaded.
Load rows explicitly:
gherkin
Given I load dataset "orders" row 0
The literal {{orderId}} in your failure is the general tell, by the way. An unresolved placeholder renders as itself rather than as an empty string, precisely so this shows up in the assertion instead of quietly comparing against nothing.
The tag still earns its keep: when the dataset changes, it is how you find everything that depends on it.