+ Start a Discussion
PavanReddyPavanReddy 

Test methods

What is the usage of test.start and test.stop and run all tests in salesforce?

 

Plz expedite me on this...

 

thnaks in advance

Avidev9Avidev9

SF docs explains them clearly

 

StartTestMarks the point in your test code when your test actually begins. Use this method when you are testing governor limits. You can also use this method with stopTestto ensure that all asynchronous calls that come after the startTest method are run before doing any assertions or testing. Each test method is allowed to call this method only once. All of the code before this method should be used to initialize variables, populate data structures, and so on, allowing you to set up everything you need to run your test. Any code that executes after the call to startTest and before stopTest is assigned a new set of governor limits.

 

 

StopTestMarks the point in your test code when your test ends. Use this method in conjunction with the startTest method. Each test method is allowed to call this method only once. Any code that executes after the stopTest method is assigned the original limits that were in effect before startTest was called. All asynchronous calls made after the startTest method are collected by the system. When stopTest is executed, all asynchronous processes are run synchronously.