Async exception in test class
Detection
- RegExp:
System.AsyncException: (.*) Apex
Examples
Error AccountTest System.AsyncException: Database.executeBatch cannot be called from a batch start, batch execute, or future method. Apex
Resolution
An asynchronous Apex call failed in a test: {1}
- Check the asynchronous calls of the tested code (batch, future, queueable): a batch or a future method can not start another one
- Run the test class on your org before publishing: sf hardis:org:test:apex
- See https://developer.salesforce.com/forums/?id=9060G0000005kVLQAY