Introduction to concise and expressive REST API testing framework — WebTau

Introduction to concise and expressive REST API testing framework — WebTauMykola GolubyevBlockedUnblockFollowFollowingMay 28IntroductionWebtau (short for web test automation) is a tool and API to write expressive and concise REST API tests.

Let’s start with a simple get-weather example.

You have a server that returns a current temperature every time you hit /weather end point.

I want to write a simple test to validate that a temperature I receive is lower than 100 Fahrenheit.

Here is a webtau test script.


should expression gets automatically mapped to the server response and triggers validation against temperature value.

To run the test, executewebtau webtau-simple-get.

groovy command line.

If a command line and standalone scripts is not your cup of tea, you can use JUnit and similar runners.

I am using Groovy for testing for the last decade and I think it is perfect for the job.

But if you are not a Groovy fan, you can use Java or other JVM languages.

CRUD exampleLet’s complicate the example and test the full Create, Read, Update, Delete cycle.

Note how test is very data focused and tries to minimize the data management boilerplate by re-using the initial payload as response expectation.

It the test above all CRUD operations are part of the same test.

Below is the example of the separating CRUD operations into their own tests.

Customer definition:Example above is using a lazyResource concept to make each test to be self contained.



if I just want to run delete test, a resource will still be created.

On the other hand if I run all CRUD tests, there will be only one post.

ReportingOne of the time consuming tasks maintaining tests is figuring out what when wrong when a test fails.

Webtau provides comprehensive console output as well as a rich, self contained html report.

console outputNote that asserted values are highlighted inside the console output.

Failures are highlighted in a similar mannerAt the end of the tests run you will be given a location of html reportOpen API, UI Testing, matchers and moreThere are a lot more features I want to cover.

There is Open API integration for tracking coverage, there is web UI testing parts of webtau that let you create comprehensive tests of your app.

There are powerful matchers and data management techniques.

Integration with JUnit5.

While I am tempted to cover them now I think dedicated posts may help to focus on one feature at a time.

If you have questions or suggestions, please leave a comment here or create an issue on github.

Getting StartedTo get started follow the official docs.


. More details

Leave a Reply