---
schema_version: "1"
id: a5f1ee257293b7d11c28f9390b5253f261e7849b84b366e7fd1a3719592e053a
title: Write Integration Tests for Agentforce and Data 360 in Apex (Developer Preview)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/release-notes/262-0-0/rn_apex_integrations_testing.md
canonical_url: https://help.salesforce.com/s/articleView?id=release-notes.rn_apex_integrations_testing.htm&release=262.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 00a489387e2cb89bbb5d476b29ab4b41d303f06a53609bfd773de79e00150184
description: 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.
products:
  - Cross Cloud
release: "262"
---
# 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](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-release-notes-salesforce_release_notes-262-0-0-production-enus/e945111b-3e0a-4011-accc-d5949363bfcc/images/icon_important.png)

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.

```json
{
  "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.

```java
@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.

#### See Also

- [_Apex Developer Guide_: Apex Integration Tests for Agentforce and Data 360 Services (Developer Preview)](https://developer.salesforce.com/docs/atlas.en-us.262.0.apexcode.meta/apexcode/apex_testing_integration_testing.htm)
- [_Tooling API_: Run Tests Asynchronously](https://developer.salesforce.com/docs/atlas.en-us.262.0.api_tooling.meta/api_tooling/intro_rest_resources_testing_runner_async.htm)
- [_Apex Developer Guide_: Build a Mocking Framework with the Stub API](https://developer.salesforce.com/docs/atlas.en-us.262.0.apexcode.meta/apexcode/apex_testing_stub_api.htm)
- [_Apex Developer Guide_: Mock SOQL Tests for DMOs](https://developer.salesforce.com/docs/atlas.en-us.262.0.apexcode.meta/apexcode/MockSOQLTestsForDMOs.htm)