Write Integration Tests for Agentforce and Data 360 in Apex (Developer Preview)

Write end-to-end Apex tests that make callouts to Agentforce and Data 360. Integration tests relax callout restrictions and transaction rollback semantics, so you can validate real service interactions and assert on actual side effects in your scratch org, without mock callouts.

Where: This change applies to scratch orgs in Lightning Experience and Salesforce Classic in Developer editions.

Important
Important This feature is available as a developer preview starting in Summer ’26. This feature isn’t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. All commands, parameters, and other features are subject to change or deprecation at any time.

Why: Standard Apex unit tests require mocking for callouts and roll back all data at the end of each test. That model works well for isolated logic, but it can’t exercise real interactions with Agentforce or Data 360. You also can’t test behavior that depends on committed transactions, such as field history tracking across updates. Integration tests overcome these limitations so that you can commit data mid-transaction, make real callouts to Agentforce and Data 360, and clean up test data with a dedicated teardown method.

How: To use integration tests, first enable the ApexIntegrationTests feature in your scratch org definition file.

{
  "orgName": "My Company",
  "edition": "Developer",
  "features": ["ApexIntegrationTests"]
}

To write an integration test class, use @IntegrationTest on both the class and each test method. To commit test data mid-transaction, use the IntegrationTest.commitTestOnly() method. Finally, to clean up committed data, add a @TearDown method.

@IntegrationTest
public with sharing class MyServiceIntegrationTest {

    @IntegrationTest
    public static void testServiceInteraction() {
        Account a = new Account(Name = 'Integration Test Account');
        insert as user a;
        IntegrationTest.commitTestOnly();

        Account result = [SELECT Id, Name FROM Account WHERE Id = :a.Id WITH USER_MODE];
        Assert.areEqual('Integration Test Account', result.Name);
    }

    @TearDown
    public static void tearDown() {
        delete as user [SELECT Id FROM Account WHERE Name = 'Integration Test Account' WITH USER_MODE];
    }
}

To run an integration test, use the Tooling API REST resource /services/data/vXX.X/tooling/runTestsAsynchronous/. You can run only one concurrent integration test asynchronously. Synchronous testing isn’t available for integration tests.