You need to sign in to do that
Don't have an account?
lalit kumar 11
basic difference between invoking apex in execute anonymous vs. unit tests
hi ,
Can anyone guide me through the basic difference between invoking apex in execute anonymous vs. unit tests or if there is any specific document on this difference ?
Thanks
lalit
Can anyone guide me through the basic difference between invoking apex in execute anonymous vs. unit tests or if there is any specific document on this difference ?
Thanks
lalit
You can use anonymous blocks to quickly evaluate Apex on the fly, such as in the Developer Console or the Force.com IDE, or to write code that changes dynamically at runtime. For example, you might write a client Web application that takes input from a user, such as a name and address, and then uses an anonymous block of Apex to insert a contact with that name and address into the database
1)https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_anonymous_block.htm
2) https://developer.salesforce.com/docs/atlas.en-us.apex_workbook.meta/apex_workbook/apex1_2.htm
But unit test is required for code coverage. PLease check below post for test classes.
1) http://amitsalesforce.blogspot.in/search/label/Test%20Class
2) http://amitsalesforce.blogspot.in/2015/06/best-practice-for-test-classes-sample.html
Let us know if this will help you
All Answers
You can use anonymous blocks to quickly evaluate Apex on the fly, such as in the Developer Console or the Force.com IDE, or to write code that changes dynamically at runtime. For example, you might write a client Web application that takes input from a user, such as a name and address, and then uses an anonymous block of Apex to insert a contact with that name and address into the database
1)https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_anonymous_block.htm
2) https://developer.salesforce.com/docs/atlas.en-us.apex_workbook.meta/apex_workbook/apex1_2.htm
But unit test is required for code coverage. PLease check below post for test classes.
1) http://amitsalesforce.blogspot.in/search/label/Test%20Class
2) http://amitsalesforce.blogspot.in/2015/06/best-practice-for-test-classes-sample.html
Let us know if this will help you
Anonymous Unit Test
-----------------------------------------------------------------------------------------------------------------------------------------
1. Record creation will store in DB Record creation – will not store
2. Enforce user permission Default system permission
3. Output verify in Log Coverage will calculate