I am getting CPU limit exception with StackTrace as only (Vendavo). But this only comes when I run the test from Apex Test Execution window from the organisation. Whereas when ran from Illuminated Cloud (Force development IDE tool) it runs fine without any error.

Is the test classes execution environment dependent. Because, Illuminated cloud is a plugin in intellij and I have a reserved memory of 4 GB of memory for intellij. And the test classes runs for 3 to 4 minutes and passes successfully whereas fails when ran from organisation under 1 minute.

  • No, the IDE you use shouldn't matter with regards to unit tests and CPU limit exceptions. Are you still seeing the same behavior? – Robert Watson Jul 22 '17 at 19:43
  • @RobertWatson Yes, still seeing the same behavior. – Nagendra Singh Jul 24 '17 at 4:08
  • It's possible that it could be an intermittent failure. Otherwise, I'm not sure what else to tell you. It's hard to debug CPU timeouts simply because the error could be caused by other packages installed in your org and not custom code. For starters, make sure that the piece of functionality you're testing is running independently of your setup test code - surround the code you want to test with Test.startTest()/Test.stopTest(). If that doesn't fix the issue, you'll have to analyze a debug log and determine if your code is inefficient. – Robert Watson Jul 24 '17 at 17:54
  • Had to reduce the number of opportunities inserted to 50. Now it is passing in both IDE and org. – Nagendra Singh Jul 27 '17 at 3:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.