menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Crank

BDD test automation for integrated SaaS.

Channels
Team

How to add steps if I have to create dependent records?

May 14, 2020 at 11:16pm

How to add steps if I have to create dependent records?

May 14, 2020 at 11:16pm (Edited 2 years ago)
I am building a recruiting app on Salesforce. A candidate will have multiple addresses, phone numbers, skill sets etc and we have them as child objects in our schema.. I was looking at creating json files for these complex relationships and parse through the json in apex to generate test data.. I looked at Crank but I could not how to approach complex dependency scenarios. Thank you..

May 14, 2020 at 11:46pm
Hey Srinivasan,
We only recently introduced initial support for scaffolding out test fixtures that have dependency relationships. You can begin to do so using Dynamic Tokens.
As an example, you might do something like...
steps:
- step: Given I create a Salesforce Candidate object
data:
salesforceObject:
FirstName: Srinivasan
LastName: Thirumalai
Other: Details
- step: And I create a Salesforce CandidateChild object
data:
salesforceObject:
ParentCandidateId: '{{salesforce.salesforceObject.Id}}'
Child: Details
Where {{salesforce.salesforceObject.Id}} is dynamically populated at run-time based on the result of the first step.