You need to sign in to do that
Don't have an account?
sujin h s
How to test a method that is returning records based on the query
I have a method in apex class which is accepting 2 parameters. The method is returning some records based on the query(2 parameters are using in where clause of the query) in that method.
Can anyone help me how to write a test case(code for test method) for that method?
Can anyone help me how to write a test case(code for test method) for that method?
It is not a recommended practice to use SeeAll data= True. This would query data in real time. This implies your code coverage would drop when deploying to production org.
Related: https://salesforce.stackexchange.com/questions/137836/test-class-for-a-method-that-returns-collection-of-records
Thanks
All Answers
If we set (SeeAllData=True)
Test data= retrieved from workbench based on query
Returned data(By apex class) = allowing the class to see the org data by setting SeeAllData= True and retrive data using query
And comparing it against each other (Test Data Vs Returned Data)
It is not a recommended practice to use SeeAll data= True. This would query data in real time. This implies your code coverage would drop when deploying to production org.
Related: https://salesforce.stackexchange.com/questions/137836/test-class-for-a-method-that-returns-collection-of-records
Thanks