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
vinni shreevinni shree 

How to create a test report data in test class

Is there any way to create test report data in test class instead of using seealldata=true? 

Thank you

VinayVinay (Salesforce Developers) 
Hi Vinni,

 You would need to use the Analytics API in your class.  Check below references that can help you.

https://salesforce.stackexchange.com/questions/188914/how-to-create-report-not-report-data-in-apex-test-class-without-using-seeallda
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_analytics_test_reports.htm

Please mark as Best Answer if above information was helpful.

Thanks,
vinni shreevinni shree

Hi vinay,

If we do this way then there might be chancing of failing deployement I guess so any other way please suggest.

Thank you
 

VinayVinay (Salesforce Developers) 
Try to implement and come back if you see any deployment failures.

For now, we have to use seealldata=true or Analytics API and I haven't seen any other way to mock test class.

Hope this helps...

Thanks,