I need to write unit tests to call a method that validates the content of a Reports.ReportResultsObject.

Is there a way to create reports programmatically, execute them and use the Reports.ReportResultsObject for a Unit Test ?


1 Answer 1


I reckon, if you just create the test data via one of the following ways

  • Create Test data as a part of your test class implementation
  • Upload a test data csv file to static resources and then access the file via Test.loadData(NameOfsObject.sObjectType, 'nameOfStaticReource');

And as long as the data that you create fits into the filter criteria of the report, your test class would give you positive result and you can assert the data.

  • okay, that means my testdata should be structured as the ReportResult Object and to figure how it's structured i can use json ?
    – blub
    Nov 16, 2014 at 15:33

You must log in to answer this question.

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