0

I'm trying to write a test around an infinite-loop bug in my Apex code. I'd love to be basically code something that runs a test for a maximum of X seconds and then asserts a false result if the timeout is reached. Is that functionality provided natively?

If not, I'll likely just set a local variable to now+Xseconds and run the test until that time.

0

You can't specify a maximum execution time natively. I've posted an idea that would probably fit your use case. I personally have a class that I insert into potentially long-running code that will periodically check for nearing limits and then throws an exception if the threshold is met.

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.