3

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 ?

Regards

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

1
  • 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 '14 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.