Monday, November 9, 2020

auto-generate mocks for testing before your dependency is ready


I have always lusted after a faster and easier way to accelerate development by generating end-to-end tests for a contract simply by writing the client or the service.  Pact is exactly what I wanted. If you are a consumer of a yet-to-be-written RESTful service or GraphQL service, you just write your client.  Then add a few tests of the contract.  Pact then generates your mock for you.  If you are writing a service waiting for clients to be written that consume your service, again, just write the code and a few tests.  Tests are the best way to communicate the terms and conditions of your contract.  Pact unblocks teams dependent on each other.  Very cool.

No comments: