Thursday, October 8, 2015

Back Door manipulation - API layer


When dealing with GUI tests, we always want those to be fast, reliable and maintainable. Even with all the DevOps infra support, like containers and VM provisioning, the presentation layer tests require significant effort to bring real product value. If we stick to the Test automation pyramid and our product is relatively small, maybe it’s not worth the bother of designing something like dedicated Shared nothing architecture test environments. But if we want to chain our UI tests to the rest of the builds in our Continuous delivery pipeline – there is no room for brittleness or slowness.
A helping hand here are the Back Door manipulation and the Fixture Setup patterns. Combining both will improve our automation UI suites.  Adding and reusing such API layer to our framework will make us fit enough to be part of the product’s daily life, not counting on heavy nightly regressions.

First of all we need to create our Service contract, I will stick to REST ones

A good design pattern that may fit here is the Fluent builder, the mandatory properties may be assured via well defined Interfaces.

To me having a Command pattern is a bit of an overkill, even if it can encapsulate a request as an object, thereby letting me parameterize clients with different requests, queue or log requests, and support undoable operations.  Having such mirages can easily lead you to over designing your functionality and adding extra complexity. So I will just use the Receiver participant. It knows how to perform the operations associated with carrying out the request.

And finally the Façade, that provides a higher-level access point, making the API subsystems easier to use(e.g. in a BDD step definitions).

No comments:

Post a Comment