Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Test Methods
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-05-2013 04:24 AM
What is the need of Test.start() and Test.stop() methods,without using these methods what issue i will get?
Thanks,
SFDC_Learner
Solved! Go to Solution.
Re: Test Methods
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-05-2013 04:30 AM
Test.start() takes you into a new context. When you setup a load of test data, execute SOQL calls against that data to extract ids etc, you will consume some of the limits for DML, SOQL etc. By executing Test.startTest() you effectively reset all those limits so that your test code starts from scratch. This allows you to be sure that any governor limits problems are entirely down to your code.
Test.stopTest() takes you back to the original context, but more importantly causes all asynchronous processing scheduled by your test to execute. So if you have @future calls to test and you don't execute this method then they won't run.
Certified Salesforce Technical Architect, Developer, Advanced Developer, Administrator, Advanced Administrator, Consultant, Sales Cloud Consultant,Service Cloud Consultant
Force.com MVP | The Bob Buzzard Blog | Linked In | Twitter
I don't respond to private messages/emails asking for help.
Take the Bob Buzzard Sobject Fields quiz.

