May 2019
Intermediate to advanced
546 pages
12h 41m
English
Some functions are only available in a testing context and are very useful. Here's an overview of some useful test functions:
|
Function |
Comments |
|
Test.getStandardPricebookId() |
When you need to create product and prices data, you need to add your product prices to the default price book. Instead of querying the default price book (Pricebook2.isStandard = true), you are able to use this function to get the default price book ID. The return value of this method is the ID of the price book that you configured as the standard price book (only one is available). |
|
Test.isRunningTest() |
This function is useful in your real code. With this function, you're able to verify whether your code runs in a user or system context ... |
Read now
Unlock full access