You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Introduction

Agent2Agent (A2A) is an open protocol enabling communication and interoperability between opaque agentic applications. Parasoft SOAtest is well-suited for testing A2A with its built-in JSON processing tools, LLM integration, and extensions for a wide array of underlying transports.

A2A Test Scenario Example

The following example illustrates how to create an A2A test scenario in SOAtest:

  1. Create a new .tst and an environment with the URL to your Agent Card.
    • The Agent Card functions as a public, machine-readable JSON metadata document, serving as an agent’s digital “business card” and advertising its identity and capabilities to potential clients.
    • It is typically published at a well-known URI, often /.well-known/agent-card.json.
    • The Agent Card is crucial for enabling agents to find and understand how to interact with one another.
  2. Create a REST Client as a Set-up Test to GET the Agent Card using the environment variable ${AGENT_CARD} for the resource.
    • Run the test once, then attach a JSON Data Bank to the Response Traffic and extract the url property to a custom column named BASE_URL.
    • Use XPath:  /root/url[1]/text()

  3. Create a Data Generator Tool as another Set-up Test to generate two random, unique ID Strings for JRPC_REQUEST_ID and A2A_MESSAGE_ID.
    • Use Pattern: &&&&&&&&-&&&&-&&&&-&&&&-&&&&&&&&&&&& for JRPC_REQUEST_ID.
    • Use Pattern: &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& for A2A_MESSAGE_ID.
    • Use Character map: 1234567890abcdef for both.
    • Be sure to configure the corresponding Data Source Column for each String.

  4. Create a Messaging Client as a Standard Test to send a message to the agent.
    • Configure the Transport tab with HTTP/1.1 so that it will POST to Router endpoint: ${BASE_URL}.
    • Alternatively, if your A2A server is using gRPC then install the gRPC extensions from the Parasoft Marketplace and configure the Messaging Client to use gRPC transport. See gRPC Extensions and Protobuf Extension for more information.

  5. Configure the message request. Change to Input mode: Literal and select MIME type: application/json. Paste in the following and configure your prompt to the agent:
    {
        "id" : "${JRPC_REQUEST_ID}",
        "jsonrpc" : "2.0",
        "method" : "message/send",
        "params" : {
            "message" : {
                "kind" : "message",
                "messageId" : "${A2A_MESSAGE_ID}",
                "parts" : [               
                    {
                         "kind" : "text",
                         "text" : "<your prompt here>"
                    }
                ],
                "role" : "user"
            }
        }
    }
  6. Add a JSON Assertor to the Response Traffic to check for errors and assert that the result state is complete.
    • To check for errors, add an Occurrence Assertion (under Structure Assertions) for XPath: /root/error and configure it so that Occurrences of element must be == expected value: [Fixed] 0. This will fail the tests if there are any errors.
    • To assert that the result state is complete, add a Value Assertion for XPath: /root/result/status/state/string() and configure it with Expected Value: [Fixed] completed. This will fail if the A2A server cannot complete the task, such as if more user input is required.

  7. Add a JSON Data Bank to the Response Traffic to extract the result text into a custom column named RESULT_TEXT.
    • Use XPath: /root/result[1]/artifacts[1]/item[1]/parts[1]/item[1]/text[1]/text()

  8. Add an AI Assertor as a Standard Test after the Messaging Client. The AI Assertor in SOAtest will use its LLM integration to decide if the result text meets the acceptance criteria.
    • The result text will be non-deterministic because it is AI-generated, so an AI Assertor is needed instead of a standard diff tool or XPath-based assertor.
    • Configure the AI Assertor input to use Data source column: RESULT_TEXT.
    • Add an assertion with a natural language prompt.


  • No labels