function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Peter Martensen 8Peter Martensen 8 

Is there a good non-developers guide to debugging Apex Test Classes?

I have an Apex Class and Apex Test Class that were written by a devloper.  I am not a developer.  I'm having trouble validating a change to the Apex Class in production but not in the sandbox.  Is there a non-developer guide to how Apex Test Classes work?  I thought the test class created a dummy record to run the Apex Class against.  I commented out the lines in the Test Class that deleted the dummy record, but I can't find it after running the test.  Am I misunderstanding how the Test Class works?
Thanks
Best Answer chosen by Peter Martensen 8
Deepali KulshresthaDeepali Kulshrestha
Hi Peter,

You will not be able to find the data which you are creating in your test class because after the execution of the test class all the data that has been made by it are rolled back from the database.

That is the meaning of the test class. It only tests the functioning of your programming without interfering with the data in your org.

For more information, you can read this blog. It will surely help you understand the working of the test class. (I have sent you this link keeping in mind you are not a developer).

https://www.testbytes.net/blog/apex-testing/
If you have any doubt about the test class you can ask me again.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com

All Answers

Deepali KulshresthaDeepali Kulshrestha
Hi Peter,

You will not be able to find the data which you are creating in your test class because after the execution of the test class all the data that has been made by it are rolled back from the database.

That is the meaning of the test class. It only tests the functioning of your programming without interfering with the data in your org.

For more information, you can read this blog. It will surely help you understand the working of the test class. (I have sent you this link keeping in mind you are not a developer).

https://www.testbytes.net/blog/apex-testing/
If you have any doubt about the test class you can ask me again.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
This was selected as the best answer
Peter Martensen 8Peter Martensen 8
Thanks for the link.
Can you tell me how to monitor the validation of the Apex Class in Production?  I know how to use the developer console to monitor an existing test, but it doesn't show anything when I'm validating.
Deepali KulshresthaDeepali Kulshrestha
Hi Peter,

If you want to see how the test class is working then I suggest you to add debug logs after the record creation, deletion, and any other changes that are occurring during your test class. Since all of the data is rolled back from the test class you cannot see its functioning.

Test classes are generally made to test the working of your program or component and also to deploy your components and programs into production. To monitor the deployment status you can check the link below:

https://help.salesforce.com/articleView?id=deploy_monitoring.htm&type=5

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com