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
TopalovichTopalovich 

Test.loadData causing compile errors in Apex unit tests and @testSetup methods

I make heavy use of CSV files as Static Resources for loading data for unit tests. Recently, and only in one specific sandbox instance, I have started to receive the following error at compile:

Method does not exist or incorrect signature: Test.loadData(Schema.SObjectType, String)

This happens on an reference to Test.loadData, and it is happening in a test class that had previously compiled and was deployed to production. Even if I simply just open and then save the test class without making any changes, I get a compile error on the Test.loadData methods.

The sandbox instance is cs14. The test class API version is 33, but I get the error in API version 34 as well. I have received this error in Developer Console, the UI, and the Force.com IDE.

Any thoughts?


Mike
Best Answer chosen by Topalovich
TopalovichTopalovich
I ended up biting the bullet and refreshing the sandbox. The compile error went away, but Developer Console is still super flaky on this instance and loses connection to the Streaming API regularly. Test execution is hit or miss as well...sometimes they kick off right away, sometimes they take their sweet time.

All Answers

pconpcon
And this only occurs on cs14?  Have you reached out to Salesforce support about it?  I don't have a sandbox on cs14, but it might be useful to compare the release version [1] of cs14 to that of your production and/or other sandboxes to see if they differ (it should differ from prod but the other sandboxes where it works would be a better comparison)

[1] http://trust.salesforce.com/trust/instances/cs14.json
TopalovichTopalovich
I ended up biting the bullet and refreshing the sandbox. The compile error went away, but Developer Console is still super flaky on this instance and loses connection to the Streaming API regularly. Test execution is hit or miss as well...sometimes they kick off right away, sometimes they take their sweet time.
This was selected as the best answer
pconpcon
That sucks but at least you've got it working.  I've had some issue recently with test execution on some sandboxes here recently too.  If you don't mind marking your answer as the best answer so that this question can be removed from the un-answered queue.