Automated testing with Choreo

Chanaka Fernando
WSO2 Best Practices
3 min readApr 27, 2022

--

How to use Choreo to test your applications while developing

Introduction

One important aspect that is tied into the development and deployment is the ability to test the code at will. Test automation is a key aspect of any software delivery process. If we think about large corporations such as Facebook, Google, or Amazon, they have built robust test frameworks so that they can release features an indefinite amount of times within a day without breaking the experience of billions of users. You don’t need to be of that scale to build a proper test automation system. But without such a framework, developers and QA engineers have to put a lot of effort to do manual testing, and the chance of bugs escaping this manual testing is much higher. Hence it is a must to have proper, automated testing if you are building enterprise-scale applications.

Choreo methodology

Choreo is a platform designed by developers for developers. It provides developers with the necessary tools to automate the testing while developing applications. We talked about the development and deployment features provided by Choreo in the first article.

Once the application is developed and deployed into the Choreo environment (production or pre-production), users can go into the “Test” phase. Testing needs to be done in the “Development” environment as well as in the “Production” environment to make sure that the application functions without any issues.

Choreo provides an integrated development lifecycle where development, deployment, testing, managing, and observing of Choreo components (e.g. API, Service, Trigger) can be easily done.

The figure below depicts the testing options provided by Choreo.

Figure: Choreo testing options

With Choreo, testing is integrated into the same deployment process. Once your code is deployed into the development environment, you can test your code from the Choreo interface itself. It provides 3 options to test the code.

OpenAPI Console

This provides a simple mechanism to test the API of the code with a sample key. This is useful for developer-level testing and it can be executed quickly. The figure below depicts the interface available under this option.

Figure: Choreo Testing with OpenAPI console

CURL

This option generates a CURL command that you can use on your computer to test the service. This is useful if you need to test the Choreo components via a remote computer such as your development machine. It provides options to include headers and parameters while generating the CURL command. The interface provided under this option is depicted below.

Figure: Choreo testing with CURL

Postman

This option is useful for doing full-blown, long-running, automated tests which is critical for production-grade services. If you have a postman account, you can connect that with Choreo and test the code using postman scripts. The figure below depicts the interface provided with this option.

Figure: Choreo testing with Postman

This makes the life of the developer easier by reducing the time to set up different test tools and run them locally. Since the testing is integrated into the deployment process, you can make sure that whatever the code you just tested can be directly moved to the production environment without any manual intervention. This means that the quality of the code that goes into the production environment is guaranteed.

Once the testing is done, the Choreo components can be exposed to the consumers directly as APIs or add an additional “Management” layer that provides security and governance to these components. The next article discusses how you can utilize the “Manage” phase of the Choreo lifecycle to securely expose your services to internal and external users.

--

--

Chanaka Fernando
WSO2 Best Practices

Writes about Microservices, APIs, and Integration. Author of “Designing Microservices Platforms with NATS” and "Solution Architecture Patterns for Enterprise"