• 1Installation
  • 2Preliminary Knowledge
  • 3Expections
  • 4Mocking
  • 5Generate Random Data

T.apex

  • Docs
  • Tutorials
Getting started with T.apex

Generate Random Data

We can generate all kinds of random data in T.apex.

Here is how we can do this:

String name = (String)T.create('Name'); // Random person names

String sentence = (String)T.create('Sentence'); // Random sentences

List strList = (List)T.create('List', new Map{
    'type' => 'String',
    'min' => 5
});
// Create a random list that contains at least 5 strings

Account acc = (Account)T.createSObject('Account', new Map{
    'fields' => new List{ 'Description' }
});
// Create a random Account object that include 'Description' field