Skip to main content

Code reviews rule: Untested Agentforce action

Written by David Martin
Updated today

Untested Agentforce action

Why is this an issue?

Agentforce actions without automated tests may fail in production:

  • Actions may return unexpected results

  • Error handling is not validated

  • Input/output mappings may be incorrect

  • Changes to underlying code can break actions

Examples

Example of incorrect setup:

An Agentforce action deployed without any test coverage in Agentforce Testing Center or Apex tests.

Example of correct setup:

Each Agentforce action requires validation with at least one test case that includes at least one assertion to verify the action's behavior in Agentforce Testing Centre.

How can I fix violations?

  1. Create action tests: Use Agentforce Testing Center for integration tests.

  2. Write Apex tests: Test invocable methods with unit tests.

  3. Test error scenarios: Include tests for invalid inputs and failures.

  4. Validate outputs: Ensure action outputs match expected format.

Resources

Did this answer your question?