Joint Report is not supported in lightning.So in our org we have an existing reports in which we pull the data from it and pass it to lightning components so that lightning we can show joint reports.
In our apex class there is a step where we query for report:
List <Report> reportList = [SELECT Id,DeveloperName FROM Report where DeveloperName =:reportDevName];
In my test class,I have created a data that satisfy report filter criteria.In test class i call apex class method where the above query is written.
In method arguments I pass report developer name that i already mention in test class.
Problem here is in the above query it does not give me any result.If I enable SeeAllData=True then it gives me code coverage.
I want to know if it possible to create report not report data in test class.
On UI when we create a report,we provide report name,developer name is auto populate and folder name when we add those report.
In Test Class is it possible to create a data like create a folder first then create an actual report?
I have searched some documents and found that whenever report test class is created then we have to mention SeeAllData in Test class.
Below is the link:
Can some one suggest me how I can proceed in such cases?
Problem is we haven’t configured our PROD environment(we are in UAT phase) yet so when we will migrate all our components and if we would not migrate the reports first then it will get failed the test class if we would use SeeAllData in test class.
I want to avoid SeeAllData in test class..
This is one of those rare situations that you can’t mock the data, nor perform a DML operation. You have two basic choices: use SeeAllData=true, or use the Analytics API in your code (basically, use a REST API), which means a pretty large refactor just to avoid SeeAllData=true. I would personally recommend simply using SeeAllData=true. Although this will complicate your deployments, there does not appear to be an acceptable alternative at this time.