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
aj2taylo2aj2taylo2 

Running testMethods: Could not run tests on class [ID]

I'm peridically getting errors in our sandbox (Winter '14) when running tests - Could not run tests on class [class Id].  If I attempt to re-run, it generally works, but one is consistently failing now.

 

There doesn't appear to be any errors with the class itself - any ideas?

 

As a side note, anyone know why the estimated code coverage is no longer visible when viewing the list of classes (Setup > Apex Classes)? 

 

Best Answer chosen by Admin (Salesforce Developers) 
amatorVitaeamatorVitae

The above solution works!!!

 

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.

All Answers

Tim BarsottiTim Barsotti

I would report this by opening a case with SFDC. They have had a couple issues around Winter 14 and tests. 

 

Code coverage had a known issue. Maybe the removed the button?https://success.salesforce.com/issues_view?id=a1p30000000T091AAC

MuppetMuppet
I am having the same problem. Looking in the debug log, I'm finding that classes with multiple test methods are executing one method only. The other methods are just not being executed. The bug notice suggests this has been fixed, but not for me. Would be interested if you have the same issue regarding test method execution
aj2taylo2aj2taylo2

I haven't been seeing the error each time now;  it looks like it hasn't been fixed for all environments yet, which instance are you on?

MuppetMuppet
I'm on Cs3 which is supposed to have had the patch applied. I've raised a case but no response as yet.
amatorVitaeamatorVitae

I'm encountering the same issue.   My Test Execution was working fine a minute ago, but now I can't get my tests to run.  I've tried reducing the number of test methods to 1, and then I tried changing the version of my test class back one version (28.0).  But still no luck :/

MuppetMuppet

Please do post back on here if you manage to sort it out because i'm tearing my hair out with it.  There is no progress on the case that I raised days ago apart from a call to ask if it is still happening !!

amatorVitaeamatorVitae

I posted a question on Salesforce.StackExchange.com here:  http://salesforce.stackexchange.com/questions/17015/could-not-run-tests-on-class

 

If I find a solution, I will post here and the site mentioned above.

amatorVitaeamatorVitae

Posted on the previous link:

 

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

amatorVitaeamatorVitae

The above solution works!!!

 

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.

This was selected as the best answer
MuppetMuppet

Many thanks for the reply.  I may try it this weekend, or possibly wait till Monday, but either way I'll post back to let you know how I got on.

 

 

MuppetMuppet

Thanks, but unfortunately it didn't work for me. I now see though that the bug notice ( https://success.salesforce.com/issues_view?id=a1p30000000T0FeAAK ) has been updated stating that Patch 6 will now fix this issue, but has not yet been deployed to my instance.

amatorVitaeamatorVitae

I think the bug has something to do with Running All Tests.

 

If your Sandbox doesn't have the patch, you might be out of luck (but shouldn't all Instances be patched by now?).  This issue is a game stopper, so I'll reiterate my solution:

 

  1. Switch Apex Test handling to Asynchronous (only one test may execute at a time).  I don't know if this really does anything, but if you're in a jam, it's worth trying.
  2. Reset your code coverage
  3. Compile All Classes
  4. Re-Run All Tests

 

MuppetMuppet

I've tried all of that, but no joy I'm afraid. 

 

If you look at , https://success.salesforce.com/issues_view?id=a1p30000000T0FeAAK , you'll see that currently, as I write, the issue is stiil live and due to be fixed in Patch 6.0

MuppetMuppet

As of this morning, our instance is now at Patch 6.1 which looks like it has fixed the problem.

DaveLDaveL

Dumb question - how are you telling what patch your instance is on?  I'm still seeing the problem in my full sandbox.

EJWEJW

We're still seeing this issue in multiple orgs.

yearofmarkyearofmark
Our Sandbox org has failed all day when running tests. This just started happening this morning.