Demo
05 CASEBOOK

Casebook

3 MIN READ

Choose the case matching the control the customer sees. Replace the sample labels and data paths with the application's real visible labels. Keep the interaction structure unchanged:

text
identify → scope → perform the action → synchronize only when needed → assert the testcase outcome

The Interaction writing guide explains why each shape is what it is. This casebook is the lookup table.

Convention — Use Then only for testcase assertions

Then is not required after every action. Use it only for a state that determines whether the testcase passes. Actions and operational synchronisation stay in the action flow:

gherkin
When I click the "New Account" button
And I wait until the "New Account" modal is ready
And I fill [$.testdata.account.name] in the "Account Name" text field
And I select "Technology" from the "Industry" picklist
And I click the "Save" button
Then the Account record page should show [$.testdata.account.name]

Do not assert that the modal opened, the field accepted text, the picklist changed, and the button was clicked — unless one of those states is itself the behaviour under test. Use a wait when a later step depends on readiness. Use one final Then for the actual business expectation whenever that is sufficient.

A data-preparation testcase may intentionally have no Then:

gherkin
When I click the "Download Customer Export" button
And I save this file as [$.output.customer_export]

Convention — Transfer files between testcases

The producing testcase saves a file as an output variable. The testsuite supplies that output to a named input variable of the consuming testcase.

Producer testcase:

gherkin
When I click the "Download Report" button
And I save this file as [$.output.report_file]

Consumer testcase:

gherkin
When I read data as CSV from [$.input.report_file]
Then the CSV should contain a row for account [$.testdata.account.id]

Use the reader that matches the file's meaning:

gherkin
When I read data as JSON from [$.input.api_export]
When I read data as Excel from [$.input.financial_workbook]
When I read text from [$.input.application_log]
When I upload [$.input.signed_contract] using the "Upload Files" control

The producer uses [$.output.<name>]; the consumer uses [$.input.<name>]. Do not pass machine-specific paths or make one testcase search another testcase's working directory.

Convention — Create unique runtime test data

{timestamp} and current_timestamp mean: append a timestamp generated during execution to a fixed value supplied by the test author. Use this pattern when created records must remain unique across scenarios and repeated runs.

gherkin
When I fill "Automation Account {timestamp}" in the "Account Name" text field

The equivalent concatenation form is:

gherkin
When I fill "Automation Account " + current_timestamp in the "Account Name" text field

Automation Account is the meaningful fixed prefix. The generated timestamp is only the uniqueness suffix. Generate a fresh suffix for each independent test case, resolve it once, and reuse the exact resolved value whenever that record is asserted, searched, updated, related, or deleted.

gherkin
When I fill "Automation Account {timestamp}" in the "Account Name" text field
And I save the filled Account Name as [$.output.account_name]
And I click the "Save" button
Then the Account record page should show [$.output.account_name]

Save the resolved value as an output when a later scenario or workflow must reference it. Never generate a second timestamp while trying to locate the record created with the first one.

The cases