Apex Integration Tests Call Real External Services (Developer Preview)

Mocks tell you what you assumed the external service returns. Integration tests tell you what it actually returns.

Where

Scratch orgs, by enabling the ApexIntegrationTests feature in the scratch org definition file.

How

Annotate a test class with @IntegrationTest and its methods can perform real HTTP callouts. Set up and tear down external test data with @BeforeClass and @TearDown. Only one integration test can run at a time and tests must run asynchronously.

Why

Response formats drift, and a passing mock-based test suite can hide a broken integration for weeks. Running against the live endpoint in a controlled test catches contract changes before deployment. Developer preview for now, so expect the shape to change.