0

Any input would be greatly apprecaiated.

I'm attempting to execute a test class, but when I run the test, I get a message saying 'too many callouts: 101' in the logs and the test fails to complete. The test class creates a single header record, then a related child record. For the life of me I can't figure out how or why the program is looping callouts over and over and over.

The functionality being tested includes a 'before update' trigger on the child record. This trigger calls out to a webservice to retrieve additional information and updates the child record.

The test class includes a mock web service - this feeds a dummy response to the webservice call.

I've tried: 1. Inserting system.debug messages throughout the test class and the code being tested to find some kind of iteration that I can't see. 2. Changing the logic to test for 'system.isFuture'

Again, any suggestions would be greatly appreciated.

-Dan

1 Answer 1

0

Try with Limits.getCallouts() in your code and getLimitCallouts() to check how many callouts have been made in that transaction. Also, use Test.startTest and Test.stopTest in your unit tests to reset limits for that test.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_limits.htm?search_text=limit#apex_methods_system_limits

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .