Agentic Workflows with the SmartBear MCP
Reflect tests can be created and run by AI Agents such as Claude Code, Codex, Cursor, etc by integrating it with the SmartBear MCP server.
Here is the link to the SmarBear MCP server documentation on how to install the MCP Server.
reminder: you must set the REFLECT_API_TOKEN environment variable for the SmartBear MCP server to authenticate and use the Reflect MCP tools.
Here is the link to the available Reflect tools within the SmartBear MCP server.
Use case: Agentic Test Case Generation
The following example will outline how an existing test artifact (such as the SAP best practice document) can be used to generate an automated test by pairing an agent with the SmartBear MCP server.
Once the user sets up the SmartBear MCP server, they may interact with their agent of choice and use the MCP prompt like:
/mcp_smartbear_reflect-sap-test I want to create an sap test case on scenario 4.2.3.1 from this BPD document <path/to/SAP_best_practice.docx>
If users are on Claude, they can leverage the prepackaged /reflect-sap-test MCP prompt that comes with the SmartBear MCP server
/reflect-sap-test prompt:
When creating an SAP test:
Always precede an input step with a click step.
Always capture a screenshot after each step, even form field actions.
If text is ellipsized with a hyphen, do not include the hyphen in your prompt step.
If you navigate to the wrong page, use browser navigation (e.g. "Click the back button") or on-screen navigation to get to the prior screen. Make sure to delete the original step and any steps you added to navigate back to the previous screen so that the test is repeatable and contains no unnecessary steps.
When applicable, use the prompt "Press the tab key" to tab through fields and the prompt "Press the enter key" to submit a form.
When building tests from BPD docs, if the input value for the next step is based on an example value in the doc, prompt the user to ask for their desired value. Provide the example value in your prompt so the user has additional context.
Optional Skill Usage and Session Compatibility
The use of this skill is not mandatory. Users of other AI Agents (like Amazon Kiro) can modify and craft their own prompts to guide the agent with more bespoke instructions as necessary. Additionally, the connect_to_session tool works for both web and mobile tests, so users may provide the sessionID of the recording session regardless of the platform type.
User may start a mobile test recording session, and grab the sessionID thats appended to the url: (example: session ID is b466a29c-efcf-4d10-87d7-4819b4b261fb from example recording).
Then you can prompt the agent:
I want to create a reflect mobile test. My session id is b466a29c-efcf-4d10-87d7-4819b4b261fb
The agent will use the connect_to_session tool to connect to the live (mobile) test session, and then prompt the user for additional directions. The agent performs the test building by iteratively adding in additional AI prompt steps after inspecting the screenshot state to complete the test objective.
Users may also connect to other MCP servers (such as Jira) to pull in their test artifacts housed in other data sources. Once your agent has access to the test artifacts (regardless of whether the format is in json, pdf, word, xlsx, etc), they are able to leverage the SmartBear MCP tools to create automated Reflect test cases based off of the test objectives outlined in the input test artifacts.
When the user tasks the agent to create a test case based on a test artifact, it will typically follow these steps:
Parse the input document to understand the test objective
Prompts the users back for any specific data configuration that is required in the test flow
Connect to a session (given a sessionID from the user)
Take a screenshot to determine the screen state
Adds a test step by emitting an intent in the form of an AI prompt step
Takes another screenshot to determine active application state to determine next steps.
The agent will loop over steps 4-6 until it either accomplishes the test objective or requires further user input (most likely due to an error preventing the agent to proceeding).
The agent has a couple other capabilities and behaviors when creating an automated test:
The agent will look into any existing segments at the beginning of the test to skip any repetitive set up steps. The user may accept or decline the use of these segments.
Agent uses
list_segments&add_segmenttools
If the agent encounters an error state within the application during test creation, the agent will perform corrective steps to return the application to the previous state. The agent will also delete any sequence of unproductive steps that may have led to this error, thereby maintaining the test integrity (the final copy of the test case will not contain the sequence of erroneous test steps that ultimately lead to a failure that must be resolved within the test).
Agent uses
delete_previous_steptool. If executing a segment results in an error, the entire sequence will be deleted from the test to remove the steps that led to the error.
The agent will add a validation step at the end of each test to confirm some signal of the test objective being met.
Agent uses
add_prompt_steptool formatted as an assertion like “Verify that XYZ is …” based on the context of the test objective.