Why would a developer use Test. startTest( ) and Test.stopTest( )? - ProProfs Discuss
Topics
Products
Follow Us:

Why would a developer use Test. startTest( ) and Test.stopTest( )?

Why would a developer use Test. startTest( ) and Test.stopTest( )?

Change Image    Delete



A. To avoid Apex code coverage requirements for the code between these lines
B. To start and stop anonymous block execution when executing anonymousApex code
C. To indicate test code so that it does not Impact Apex line count governor limits.
D. To create an additional set of governor limits during the execution of a single test class.

This question is part of Salesforce Platform Developer 1
Asked by Wyatt Williams, Last updated: Jan 17, 2020

+ Answer
Request

2 Answers

e.Ronald

E.Ronald

Answered Jan 03, 2018

When the test actually begins in a Salesforce account, that can be determined using the starttest method. This will noted in the test code. Everything listed in the test code before the start test is the part that needs to allow to you do the test. There are certain limitations that can occur during the start test and stop test methods.

Only two SOQL queries can be made between these two parts. The parts of the code that falls in between the starttest and stoptest is the new set of governor limits. When a user develops these two methods in the test code, they are doing this in order to create an additional set of governor limits. This would take place during the execution of a single test class.

 

John Smith

John Smith

Answered Apr 26, 2017

To create an additional set of governor limits during the execution of a single test class.

####
 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.