You need to sign in to do that
Don't have an account?

System.Async Exception : Test failures when I run all tests
Hi,
I have created some batch apex code alongwith other triggers and class/controller codes.
When I run individual test methods on them, I am able to get test success result alongwith nice code coverage %. However when I run all tests together, I get following test failure errors:-
1)System.AsyncException: Database.executeBatch cannot be called from a batch or future method.
2)System.AsyncException: Future method cannot be called from a future method: changeOwners(String, String)
3)System.AsyncException: Future method cannot be called from a future method: getLead_Rollup_Amount(Id)
4)System.AsyncException: Future method cannot be called from a future method: changeOwners(String, String)
Please note again that the exceptions dont come when tested individually.
Please advise on same.
Thanks,
Vimal
It was an issue on salesforce.com's end. There was nothing required on the user side to fix this issue.
All Answers
I too am having the same problem and it just started this morning. I can also get them to fail occasionally if I run them individually, but they always fail when I run them all at once. We have made no changes to our code and they used to work just fine.
To be clear, the only tests that are failing are the ones that involve starting a batch job, giving the same 'async' error described above. This happens for EVERY test that involves batch jobs and occurs across the different ORGs that we have set up.
We are seeing the same issue today on a unit test we've had in place for several months. The test runs fine if we run it individually. We are also fine when we run tests for ALL classes from the ide. But when we run tests for all classes from the browser based development environment, it fails.
Yes, i start hitting the same issues this morning. I think is a Salesforce bug related to the new release. So i hope to have some solution shortly because i need to package my application and this is blocking me.
J.
any words, guys?
I am dead in the water with this problem.
did they fix it?
thanks!!!
I'm also dead with this! I had planned to build a release package today!
HELP! HELP! :manmad:
I'm having the same problems with "Database.executeBatch cannot be called from a batch or future method.".
Here's what I've found which seems consistent with others:
Justin
I opened a case for this yesterday morning when we realized that it was more than just us.
But they just contacted me saying they are looking at it this afternoon.
We have a bug created for this problem and are looking at it now. It only occurs when you execute more than one executeBatch in a runTests request.
No ETA on fix, but this is a high priority.
Same problem with two batches.
I tried with separate test classes, separate test methods, but only when each batch is tested separately, the tests run without an error. No difference running test in IDE or browser.
Hi all -
Apparently this is a known issue with SFDC support and they will have a e-patch by today 12/14 or 12/15. Here's hoping this is true....there was a problem with the async object
Does anyone have idea on what was the cause of issue and what were the steps followed to resolve them?
Thanks,
Vimal
It was an issue on salesforce.com's end. There was nothing required on the user side to fix this issue.
Could this be caused by record locking? I am experiencing the same issue, but mostly with Bulk tests. They are giving a "Apex CPU time limit exceeded" error. So I figured, when I try to save a record and another test is holding a temporally record lock, then my bulk test is waiting until it is released (or timed-out), the sum of all that waiting for released record lockes could cause my Bulk test to fail.
The real question is then: do Unit Test Classes affect the record locking for eachother?