Foundry allows you to reference objects in Gherkin steps using names (from the registry) or special placeholders.
In Table Cells (Automatic Resolution)
If a property type is a registered factory, you can simply use the object's name. If automatic resolution fails, use the escape hatch:
<foundry:object(type, name)><foundry:lastObject(type)>: References the row with the highest ID in the database.
In Plain Step Arguments (Placeholders)
Placeholders using the foundry: prefix work in plain text arguments (e.g., in URLs or specific step strings):
<foundry:id(type, name)>: The ID of a named object in the registry.<foundry:lastId(type)>: The ID of the row with the highest ID in the database.
| Placeholder | Works in | Resolved from |
|---|
<foundry:object(type, name)> | Table cells only | Object registry |
<foundry:lastObject(type)> | Table cells only | Database (highest ID) |
<foundry:id(type, name)> | Plain step arguments only | Object registry |
<foundry:lastId(type)> | Plain step arguments only | Database (highest ID) |
Warning: <foundry:lastId(...)> assumes IDs follow creation order (auto-increment, sequences, or time-ordered UIDs like UUID v7/ULID). For random IDs (UUID v4), use named objects with <foundry:id(factory, name)> instead.
# Using object names in tables
Given there is a category named "tech"
Given there is a post named "my-post" with:
| title | category |
| My Post | tech |
# Using escape hatch in tables
Given there is a post named "my-post" with:
| title | category |
| My Post | <foundry:object(category, tech)> |
# Using lastObject in tables
Then post named "my-post" should have properties:
| category |
| <foundry:lastObject(category)> |
# Using placeholders in plain arguments (URLs)
When I am on "/contacts/<foundry:lastId(contact)>"
When I am on "/contacts/<foundry:id(contact, john)>"