Friday, December 18, 2020

Writing Compile Time Tests

Wouldn’t it be great if your tests could find bugs before they were even run? Here is how you can do just that when validating data-type issues in REST responses. It takes just a small change, but when done thoughtfully, it can be a useful tool in your testing tool belt.

First, we will see an example of tests with the “normal” way to setup JSON assertions in API tests to show how they could be improved.  Then, we will rewrite our tests to find the same bug, but the test will fail faster, letting us know at compile-time that something is wrong without having to even run the tests!



from DZone.com Feed https://ift.tt/3gXV8so

No comments:

Post a Comment