BLOG
Running REST Assured API Tests in VSTS Release Management
What is REST Assured?
REST Assured is a popular Java based open source tool for testing and validating REST services. REST Assured uses Gherkin/Behavior Driven Development (BDD) language of given, when, then to create human readable executable specifications. REST Assured has built in support for performing REST based actions and validating the results. I have found it easy to use and read the tests.
Getting started with REST Assured
Maven is a tool used to create a standard way to build Java projects. I have used Maven off and on over the years with Java development. If you are new to Maven, I found this good tutorial for getting started with Maven. By following this tutorial, you will have a project you can begin using to create your REST Assured project.
Once you have the project created, adding the REST Assured dependencies is straightforward and there are a number of tutorials that walk through this. Here is the dependencies list. You can also look at my github repo at https://github.com/Deliveron/sample-rest-assured-api-tests

Authoring and Running in VSCode
When opening the folder in VSCode, VSCode will recognize the Maven project using Java and JUnit and recommend several extensions to install. I recommend doing accepting the recommendations. This enabled VSCode to handle compiling, maven dependencies, intellisense, and even the test runner to run the REST Assured tests.

The REST Assured tests are easy to author and using the given, when, then format provide human readable tests. As you can see in the image below, with using a couple extensions VSCode can execute and track test results.

Running Tests in Visual Studio Team Services (VSTS)One advantage of running API tests over UI tests is that they are much faster. This allows you run the tests as part of your software delivery pipeline to help ensure quality is maintained. In VSTS, the API tests are typically run in Release Management after the application has been deployed.

To run the REST Assured tests, use the Maven task above. Point the task to your POM.xml file. This will compile the test code and execute the tests.

VSTS Hosted Build Agents
Microsoft offers Windows, Linux, and MacOS Hosted Build Agents platforms depending on your needs. Some builds such as IOS require MacOS while others may need to run on Windows or Linux. For running REST Assured API tests, Maven and Java are installed on all 3 of the Hosted Agents. Regardless of the platform you need for your pipeline, you can run the REST Assured tests on any of the Hosted Agents.
The results of the REST Assured API tests are tracked with each release and you can use all of the built in features for managing the results including linking bugs and associating the tests back to requirements for traceability. As you can see below you can measure quality by requirement.

If you are looking for a RESTful services friendly framework and can use Java, REST Assured is good tool for doing this. REST Assured tests can easily be integrated into your VSTS Release for continuous delivery.
If you have any questions or comments, contact me on twitter athttps://twitter.com/mikedouglasdev