Lab 6 - MCP
In Lab 5 your agent wrote tests without seeing the page. Lab 4's REPL step could show it one, but only while a single command ran. Now give it a session that stays open: the Robot Framework MCP server runs one keyword at a time, keeps the browser between the agent's steps, and lets the agent look at the page before it decides the next step. Rebuild one of your Lab 5 tests that way, and compare.
| Module | 6 - Robot Framework MCP: The Live-Access Upgrade |
| Time | 25 minutes |
| Shop preset | clean |
| You need | Lab 5 done: one passing test of your own. If you have none, rebuild WEB-004_AC-3 instead |
| You start from | Your repository after Lab 5 |
Steps
-
Connect the server. Copy the configuration for your agent into place, from the repository root.
mcp/README.mdexplains each line:Claude Code Codex GitHub Copilot cp mcp/claude-code.mcp.json .mcp.jsonmkdir -p .codex && cp mcp/codex.toml .codex/config.tomlcp mcp/copilot.json .github/mcp.jsonCodex asks before each call to one of the server's tools;
mcp/README.mdshows how to allow them all. -
Check the connection in a new session:
Claude Code Codex GitHub Copilot approve the project's server when asked, then /mcpcodex mcp listcopilot mcp list -
Rebuild one test stepwise. Pick one criterion of your Lab 5 slice. For WEB-004_AC-3:
Using the robotframework MCP server, build a test for WEB-004_AC-3 step by step. First import the variable file shop/variables.py and the resource file resources/shop.resource, and open the shop with Open Shop Browser and Start Shop Test. Then do one step at a time, and look at the page after each step before you choose the next. Use roles, labels and visible text for locators. When every step works, save the test as tests/ui/search_stepwise.robot, with its locators in keywords under resources/.
Follow the tool calls: a step runs, the agent reads the page, the next step depends on what it saw. For another story, name the file after its area, for example
tests/ui/cart_stepwise.robot. -
Run it yourself:
uv run robotcode robot tests/ui/search_stepwise.robot -
Compare the two versions of the same criterion:
Compare the test for WEB-004_AC-3 in tests/ui/search.robot with the one in tests/ui/search_stepwise.robot, and the keywords they use. Which locators and waits differ, and which assumption of the first version did live access confirm or correct?
Note one thing live access changed, and one thing it did not. Then keep the better version and delete the other: two tests for one criterion help nobody.
-
Look at the cost. MCP tools are loaded into the agent's context. In Claude Code,
/contextshows how much of it the server's tools take. Files, command-line tools and skills are cheaper. Use MCP where live, stateful interaction earns its keep.
Stretch
Change the page under the agent's feet. Keep the session open, and in a terminal switch the shop to a later layout:
uv run --no-sync python -m shop preset stage3
Ask the agent to run the steps of step 3 again, and to tell you what changed on the page. Then put the shop back:
uv run --no-sync python -m shop reset
Compare with the reference
When you are done, compare your result with the reference: what the rehearsal produced, why it is a good result, and the answers the debrief covers. Open it after the lab: it gives the answers away.
If your agent fails
Follow the recorded walkthrough of this lab, which rebuilds WEB-004_AC-3.