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
saraha@groupesci.comsaraha@groupesci.com 

How can we unit test the controller for a Read-Only page?

Hello All,

 

So I have a nice read only page that gets tons of records from the controller. The trouble is, when I write a unit test for the controller it fails because I get more than 50k records!

 

Any suggestions?

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
mtbclimbermtbclimber

You need to write your test in a manner that scopes it to exclude existing org data.   Your test should create the data it needs.

 

We're working on a mechanism to allow a developer to forcibly constrain the scope of a test but for now you would need to construct your test to be sure it was exclusive so you don't hit these limits.

All Answers

mtbclimbermtbclimber

You need to write your test in a manner that scopes it to exclude existing org data.   Your test should create the data it needs.

 

We're working on a mechanism to allow a developer to forcibly constrain the scope of a test but for now you would need to construct your test to be sure it was exclusive so you don't hit these limits.

This was selected as the best answer
saraha@groupesci.comsaraha@groupesci.com

Ok makes sense. Thanks for the quick reply.