Crank - v0.10.0
New in this Version
- Dynamic Tokens - As of
v0.10.0
, building on the extra metadata made available inv0.9.0
, Crank supports Dynamic Tokens, which allow scenarios to be written with assertions and actions that depend on data that is only known at run-time. An example use-case is outlined below. [#43, #48]
Salesforce Object Assignment and Reference Precision
scenario: Salesforce Account Assign
description: Proves...
tokens:
test.account: A Test Account
test.email: [email protected]
steps:
# This step exposes the ID of the created Account as a token.
- step: Given I create a Salesforce Account
data:
account:
Name: '{{test.account}}'
- step: And I create a Salesforce Contact
data:
contact:
Email: '{{test.email}}'
LastName: Tommy
# Note: The ID can be used to assign the contact to the account.
AccountId: '{{salesforce.account.Id}}'
# The ID can be used to precisely target the object for field comparison
- step: Then the Name field on Salesforce Account with Id {{salesforce.account.Id}} should be {{test.account}}
- step: And the AccountId field on Salesforce Contact {{test.email}} should be {{salesforce.account.Id}}
- step: Finally, delete the {{test.email}} Salesforce Contact
# And it can be used to precisely target the object for deletion (no more ambiguity)
- step: And delete the Salesforce Account with Id {{salesforce.account.Id}}