How to Use Apidog CLI in GitHub Copilot for API Testing

Learn how to configure Apidog CLI in GitHub Copilot to automatically run API tests in agent mode. Enhance your development workflow.

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

Integra pruebas API en el loop de Copilot con Apidog CLI

In the fast-paced landscape of modern software development, integrating artificial intelligence tools into daily workflows has become a key differentiator. GitHub Copilot, especially its agent mode, allows developers to delegate repetitive tasks and focus on business logic. However, one area traditionally left out of this automated loop is API validation. This is where Apidog CLI comes into play, offering an elegant way to incorporate API testing directly into the edit-test-fix cycle that drives Copilot. At Q2BSTUDIO, as a company specialized in software development and technology, we have explored this synergy to improve the quality of our deliveries, especially in projects requiring custom applications with high integration with cloud services.

To understand the potential of this combination, we must first analyze how Copilot's agent mode works. Unlike the standard chat mode, the agent operates in an autonomous loop: it modifies files, executes terminal commands, reads output, and decides the next step. This behavior makes it an ideal candidate for integrating automated tests that require execution and result analysis. However, by default, Copilot does not know how to run specific API test suites unless given proper instructions. Apidog CLI, an npm package called apidog-cli, fills that gap by allowing test scenarios created in Apidog to be launched directly from the command line.

The key lies in repository configuration. Copilot reads custom guidelines from the .github/copilot-instructions.md file. By including an instruction block in that file that describes how to run Apidog CLI, the agent gains the ability to fire API tests, read the exit code, and if it is non-zero, iterate over the code to fix detected errors. This turns API tests into another component of the edit-test-fix workflow, reducing feedback time and increasing confidence in changes made.

The practical process begins with installing Apidog CLI via npm install -g apidog-cli and authenticating through apidog login. Once the command apidog --version responds correctly, the aforementioned instructions file must be created in the repository root. Inside it, a dedicated section for API tests is added, indicating the exact command Copilot should execute. For example: apidog run -t 123456 -e 789012 -r cli. It is important to specify that the exit code determines success or failure, and that Copilot must interpret any non-zero code as a failure, even if the textual summary looks positive.

A crucial detail is obtaining the correct command. Apidog provides a CI/CD tab within each test scenario, where it automatically generates the command with precise scenario (-t) and environment (-e) identifiers. Copying and pasting that command into the instructions file eliminates ambiguities. Additionally, it is recommended to keep the cli reporter so Copilot can read output directly from the terminal and use it to decide next steps. If a visual report is desired, the html reporter can be added, generating a file in ./apidog-reports.

Once configured, the workflow becomes iterative and autonomous. The developer makes code changes, for example in a REST API handler, and then asks Copilot to run the Apidog tests. The agent locates the command in the instructions, executes it in the terminal, analyzes the output, and if an error is detected — such as an incorrect status code or a missing field — proceeds to modify the source code and re-runs the tests. This cycle repeats until all assertions pass. The result is continuous validation that occurs while the developer is still immersed in the task, not after the code has been submitted for review.

From Q2BSTUDIO's perspective, this integration fits perfectly with our philosophy of offering comprehensive solutions that range from cloud AWS/Azure to artificial intelligence and cybersecurity. When we develop custom applications for clients that require microservices exposed via APIs, the quality of those endpoints is critical. Incorporating Apidog CLI into Copilot's flow allows us to detect regressions immediately, without waiting for an external CI/CD pipeline to run tests. Additionally, by working with AI agents that can read and correct code, we reduce manual load and accelerate delivery cycles.

Another aspect to consider is security. Copilot, in agent mode, has the ability to execute commands in the developer's terminal. To avoid risks, it is essential that the instructions file does not contain access tokens. Instead, authentication must be performed beforehand via apidog login, and trust that the agent will not modify that command to insert credentials. If the agent tries to add the --access-token option, the instructions should clearly tell it not to. At Q2BSTUDIO, we apply cybersecurity policies that include reviewing the commands Copilot proposes to execute, especially those interacting with staging or production environments.

The combination of Apidog CLI with Copilot also opens the door to better integration with Business Intelligence tools (e.g., Power BI). APIs that serve data to dashboards must be robust and reliable. By having automated tests run every time an endpoint is modified, we ensure that BI reports are not affected by unexpected changes. Similarly, in AI projects that consume APIs for training data or inference, continuous validation is indispensable to maintain model quality.

Finally, it is important to verify that Copilot actually executes the command and does not just simulate the action. It is recommended to inspect the terminal to confirm that the line apidog run ... appears and that the agent reports the exit code. If the agent claims the test passed but the exit code is non-zero, the exit code must be prioritized. This verification discipline avoids false positives and maintains process integrity. At Q2BSTUDIO, we train our teams in these good practices, ensuring that automation with AI agents does not compromise software quality.

In conclusion, using Apidog CLI with GitHub Copilot for API testing is not only possible but highly recommended for teams looking to accelerate development while maintaining high quality standards. The setup is straightforward: install the CLI, create the instructions file, copy the command from Apidog, and trust the agent. The benefits — immediate feedback, reduced production errors, integration with CI/CD pipelines — justify the time investment. At Q2BSTUDIO, we have seen how this synergy between AI tools and automated testing enhances our ability to deliver robust and scalable custom applications, whether on cloud AWS/Azure, with cybersecurity layers, or with BI dashboards. We invite developers to explore this integration and discover how they can transform their daily workflow.

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.