27

Today, I am writing test code in my Sandbox, and until 15 minutes ago, my test execution was working. Now, all of a sudden, my tests stopped working. I can't run even a single test!

Test execution says: Could not run tests on class 01pc00000005VHc (or whatever the Id is of the test I'm trying to run).

I found this post describing the same issue with Winter '14 API: http://boards.developerforce.com/t5/Apex-Code-Development/Running-testMethods-Could-not-run-tests-on-class-ID/td-p/677209

I tried changing the version of my test code back to version 28.0 as well as only having one testMethod in my test class, but nothing solved my issue. I can't run any test code!!!

Any ideas? Many will be much appreciative!

  • How many tests do you have in each test class? – kibitzer Sep 20 '13 at 18:19
  • it varies. some have 1 testMethod while others could have up to 10. Nothing absurd. – Scott Pelak Sep 20 '13 at 18:28
  • and to note, since the issue first occurred, I now can't run any test code--even code that has always passed its tests. – Scott Pelak Sep 20 '13 at 18:30
9

This is happening for me both on cs18 and cs17. Seemingly random changes allow the test classes to run. Actually they always run, they just report this error anyway. I haven't found a set of random changes that allow the classes to run and for the code to work. For example, if I reference Trigger.new from one of my custom triggers I get the error from any test class that ends up invoking that trigger...

I finally checked the box "Store Only Aggregated Code Coverage" and that seemed to resolved the issue. It is not like salesforce has ever actually reported the correct lines in the coverage results, so there is no real loss here.

  • I marked this as the solution because it remediates the current version of the issue (related to the release of Winter '14). I've encountered this issue before API v29.0 was released, but that problem has a slightly different solution – Scott Pelak Nov 13 '13 at 15:08
  • UPDATE: Today, I've had to check, uncheck, and check Store Only Aggregated Code Coverage again to get tests to run – Scott Pelak Nov 19 '13 at 22:29
12

EDIT:

The solution is for problems caused before the release of Winter '14.


First, thank you for the help!

Here's how the solution worked for me:

As posted above, the link, https://success.salesforce.com/issues_view?id=a1p30000000T091AAC, suggests:

Code coverage should be provided upon running all tests.

So, I went to Develop --> Apex Text Execution and

  1. After clicking Options..., I checked Disabled Parallel Apex Testing
  2. And then clicked the link "View Test History" where I clicked Clear Test Results.

Then I went to Develop --> Apex Classes and

  1. Clicked "Compile all classes"
  2. Then clicked "Estimate your organization's code coverage"
  3. And finally, I clicked Run All Tests

After all that, I am now able to execute Apex tests again.


Update (2013-11-05):

With the release of Winter '14, many bugs slipped into the Change Sets process. I ran into this same issue as described in the question, but now the answer I gave doesn't solve the problem (this is a new issue as of circa November 2013). I created a ticket with Salesforce Support, and all they can tell me is:

  1. There have been many issues with Changes Sets after releasing Winter '14, and there is a team working on creating a patch to correct the issue (ETA = unknown)
  2. The IDE plugin for Eclipse does work, and that's pretty much all that is available until the patch is created.

Until then, cheers!

  • 2
    Just saw this in my Winter 14 sandbox for the first time. The linked issue above (listed as Fixed on all servers) looks like a different issue. I was not trying to estimate code coverage, just run a single test class. Oddly, I could still view results of individual tests (in dev console or the Apex Test Execution page), but the top level result was Could not run tests on class.... I already had parallel testing disabled, so I cleared all test result and used "Compile all classes"; my tests are working again. Whatever the issue is, it's not truly fixed. – Jason Clark Nov 4 '13 at 14:02
  • your issue is not the same as the issue I faced. the upgrade to Winter '14 created bugs with Change Sets. check out my update. (I ran into this issue again last week, and all Support could tell me is that the IDE works so just use that -- not the answer I was looking for, but at least there's a workaround) – Scott Pelak Nov 5 '13 at 17:21
  • It looks like there is a separate known issue, that is marked as fixed, but it's still happening in our orgs: success.salesforce.com/issues_view?id=a1p30000000T0FeAAK – Mikey Nov 5 '13 at 17:26
  • 1
    it's still a problem with one of my orgs on NA8. I was on the phone with support this morning. – Scott Pelak Nov 5 '13 at 17:26
  • I am having the same problem. sometimes it work. sometimes totally not working. – kitokid Nov 11 '13 at 3:20
6

The bug referenced here: https://success.salesforce.com/issues_view?id=a1p30000000T091AAC has been fixed on most sandbox orgs (I just checked it on ours, having experienced the problem, and the test code is now running). It sounds to me that your org has just gotten "stuck" - I've seen this happen before. Try the following:

  1. Deploy your code to another dev org if possible and try running tests there. If they pass, it's an org specific issue and not your code.
  2. Disable parallel Apex testing. They never have gotten that working properly, and it can cause false errors and freeze all testing on an org for a while.
  3. Wait a few hours and try again. If it still fails, open a case.

It does sound to me that your org has gotten itself into an odd state, and these things usually do resolve themselves after a while.

Good luck

2

I saw the same problem on cs13 just now. As the previous poster said, I checked the box "Store Only Aggregated Code Coverage" on the Apex Test Execution page's Options pop-up, and that seemed to resolve the issue.

Then, just for fun, I un-checked it, and the issues seemed to still be resolved - checking the "Store Only Aggregated Code Coverage" box, then un-checking is seems to do the trick.

1

Try re-saving affected classes, even if you don't make any changes. This resolved the issue for me.

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.