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..

1 Answer 1


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.

  • Thank you so much..it looks like i have to arrange all components for PROD Deployment.Do u have any recommendation in order to avoid deployment nightmare?
    – SFDCDJ
    Commented Aug 17, 2017 at 15:02
  • 1
    @DhananjayPatil I believe you should be fine as long as all of your components are in the same package. Tests are not run until all objects have been staged.
    – sfdcfox
    Commented Aug 17, 2017 at 15:03
  • Well at this moment we have divided our components because of 3rd party application dependency.In One package we have Apex and all configurations and in other package we have reports.Looks like i have to merge those package based on ur latest comments
    – SFDCDJ
    Commented Aug 17, 2017 at 16:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .