Run API Tests with Apidog CLI in Windsurf IDE

Learn how to integrate Apidog CLI in Windsurf IDE to let Cascade run API tests automatically. Boost code quality with AI-driven testing.

martes, 28 de julio de 2026 • 6 min read • Q2BSTUDIO Team

Configura pruebas automáticas con Cascade y Apidog CLI

In modern software development, artificial intelligence agents are transforming the way teams write and maintain code. However, for these agents to be truly useful, they need a feedback loop that automatically verifies their changes. This is where the combination of Apidog CLI and the Windsurf environment comes into play, a solution that allows AI agents to execute API tests directly from the terminal and act on the results. This approach not only accelerates development but also reduces production errors and strengthens code quality.

Windsurf, Codeium’s agent-capable IDE, incorporates an assistant called Cascade that can read the repository, modify files, and run commands in an integrated terminal. The traditional problem is that API tests are often outside the agent’s scope because they require external tools or manual clicks. With Apidog CLI, an npm package that lets you launch test scenarios designed in Apidog from the command line, Cascade can incorporate these tests into its main loop: it edits code, runs the test, reads the result, and decides the next step. This is a virtuous circle that mimics a human developer’s workflow, but with machine speed.

For this integration to work, the first step is to install and authenticate Apidog CLI in the development environment. The command apidog --version confirms it is available, while apidog login ensures the terminal has valid credentials. Once ready, the next step is to define a persistent rule within the project. In Windsurf, rules are stored in Markdown files inside the .windsurf/rules/ folder. Creating a file called apidog.md in that path allows Cascade to remember how to run tests in every session, even when working in a team thanks to Git version control.

The rule must contain the exact command that Apidog generates for each scenario. Instead of inventing identifiers, it is best to open the test scenario in the Apidog interface, go to the CI/CD tab, and copy the apidog run line with its real parameters. For example: apidog run -t 12345 -e 67890 -r cli. This command includes the scenario ID, environment, and reporter format. The rule should specify that exit code 0 means total success and any non-zero value indicates failure, and also make clear that the machine is already authenticated, so no access token should be added to the command.

Once the rule is in the repository, Cascade loads it at the start of the session. When modifying code that affects an API, the developer can ask: 'Run the Apidog scenario and tell me the exit code.' Cascade will execute the defined command, read the terminal output, and if any assertion fails, use the error details to automatically correct the code. This turns API testing into another step of the editing pipeline, reducing reliance on manual tests at the end of the cycle.

For the process to be reliable, it is important to verify that Cascade actually executes the command. Windsurf’s integrated terminal shows each instruction with its complete output, including the exit code. If the assistant claims the test passed but the exit code is not zero, trust the code. Additionally, the cli reporter format prints each request, each assertion, and the expected versus actual values inline, allowing Cascade to identify exactly which field failed. If an additional visual report is needed, you can add the html reporter to generate pages in the apidog-reports folder, always keeping the cli format for the agent to read.

Beyond the technical setup, this approach has a direct impact on team productivity and software quality. At Q2BSTUDIO, as a company specialized in custom software development and artificial intelligence integration, we have seen how automating API tests within the agent workflow drastically reduces correction times. Our teams design scenarios in Apidog that cover critical endpoints, and then Cascade runs them every time a handler is modified. The result is more robust code and fewer regressions.

The combination of Apidog and Windsurf also aligns with best practices in cybersecurity and cloud computing. By being able to run API tests in staging environments hosted on AWS or Azure cloud, teams verify that changes do not introduce vulnerabilities before reaching production. Moreover, the ability to integrate these same commands into CI/CD pipelines (for example, with GitHub Actions) ensures that verification is consistent both in the local developer environment and in continuous integration.

For teams working with Business Intelligence, API tests are essential to validate that the endpoints feeding Power BI dashboards return the correct data structure. If a backend change alters the JSON format, Cascade can detect it instantly and correct the error before the report becomes outdated. Similarly, in environments where AI agents are deployed for data processing, continuous API verification prevents cascading failures.

A key aspect for the success of this integration is managing permissions in Windsurf. The IDE offers several automation levels: from allowing all commands (Turbo) to requiring approval for each one (Disabled). For an optimal balance, the apidog command can be added to the allowlist (windsurf.cascadeCommandsAllowList), so Cascade can run it without intervention, while other more dangerous commands still require permission. This configuration allows the agent to work autonomously but within safe limits.

There is also the option to connect an Apidog MCP (Model Context Protocol) server, which allows Cascade to read API specifications directly. However, most use cases are covered by the CLI: running scenarios and reading results. The separation of responsibilities is clear: the CLI runs the tests, the MCP provides context for writing code. At Q2BSTUDIO we usually recommend starting with the CLI approach for its simplicity, and later adding MCP if the team needs the agent to understand the full API structure before editing.

Setup can encounter some common obstacles. If Cascade ignores the rule, check that the file is at the exact path .windsurf/rules/apidog.md, has the .md extension, and the content does not exceed 12,000 characters. Sometimes the agent tries to add an access token to the command; simply remind it in the rule that the machine is already authenticated via apidog login. If an unknown option error appears, Cascade has probably invented flags; the solution is to run apidog run --help and use only the listed options.

In short, integrating Apidog CLI into the workflow of an AI agent like Windsurf’s Cascade is not just a technical improvement, but a paradigm shift in how software is developed. API tests are no longer a manual step relegated to the end of the cycle; they become part of the agent’s iterative loop. This allows errors to be detected the moment they are introduced, saving hours of debugging and preventing production incidents.

For companies looking to adopt these practices, having a technology partner with experience in artificial intelligence, cloud, and cybersecurity makes the difference. At Q2BSTUDIO we offer consulting and development services to implement these workflows, designing custom test scenarios and configuring agent environments that maximize team productivity. The future of development is automated, intelligent, and quality-driven, and this integration is a solid step in that direction.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.