5.6k views
5 votes
Do you have to use startTest() and stopTest() together?

1. Yes
2. No

1 Answer

5 votes

Final answer:

No, startTest() and stopTest() do not have to be used together in Salesforce.

Step-by-step explanation:

No, you do not have to use startTest() and stopTest() together in Salesforce. These methods are used in Apex test classes to separate the limits of a test from the limits of the actual code execution. startTest() marks the point where the limits are reset, while stopTest() marks the end of the test. Using startTest() and stopTest() together is helpful when you want to accurately measure the limits used by a particular piece of code during testing.

User SanduniYW
by
8.1k points

No related questions found