Skip to content

gramier/TestDataFactory

 
 

Repository files navigation

Apex Test Data Factory

“ The ultimate Apex Test Data Factory ” 🏭 👌

Generate & insert an sObject with all the required fields & relationships auto-filled

Contact con = (Contact)TestDataFactory.createSObject('Contact');

Inserted data*:

Contact:{Id='0036E00000R4nG0QAJ', Lastname:'test0'}

Assign values to fields of the main sObject and the related sObjects

Contact con = (Contact)TestDataFactory.createSObject('Contact', new Map<String,Object>{
  'Email' => '[email protected]',
  'Account.Description' => 'Text for the Description field on the Account'
});

Inserted data*:

Contact:{Id='0036E00000R55chQAB', Lastname:'test0', Email:'[email protected]', AccountId='0016E00000Z6bC7QAJ'}
Account:{Id='0016E00000Z6bC7QAJ', Name='test0', Description='Text for the Description field on the Account'}

* in a vanilla org

Install :

Click on the package image to install the TestDataFactory Unlocked Package 🔓📦

More :

Apache 2.0

About

The ultimate Apex Test Data Factory 🏭

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Apex 100.0%