We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

System testing with Pytest, Docker, and Flask

Formale Metadaten

Titel
System testing with Pytest, Docker, and Flask
Serientitel
Anzahl der Teile
132
Autor
Lizenz
CC-Namensnennung - keine kommerzielle Nutzung - Weitergabe unter gleichen Bedingungen 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen und nicht-kommerziellen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen und das Werk bzw. diesen Inhalt auch in veränderter Form nur unter den Bedingungen dieser Lizenz weitergeben
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache

Inhaltliche Metadaten

Fachgebiet
Genre
Abstract
The composability of fixtures in pytest is an improvement over traditional xUnit setup/teardown, reducing the incentive to commit testing crimes such as multi-stage and stepwise tests. This is great out of the box for unit tests, but I'm going to show how to combine the power of pytest fixtures with Docker to build high-level integration tests for microservices or other complex systems with multiple components. I'll then build on that to show how to embed mock web services written with Flask right into the test code. With a sample Java application that makes use of some external resources to offer a data processing service I'll first quick an overview of Pytest, Docker, and Flask. Then I'll mix some pre-built code with live test coding to demonstrate how to build high-level system tests which spin up the application and its dependencies in Docker. I'll then mock one of the external dependencies using Flask, allowing the test to control and verify interaction between the system components. Finally I'll show how to wrap the Flask application in a WSGI middleware that lets the test inspect interaction with the mocked service. From a learning and development point of view, building your own is better than re-using someone else's code so I'll show how the support code for these features is relatively simple and how the audience can build it themselves to exactly meet their own needs. And I'll do it all with a sense of fun, a joke or two and maybe a little storytelling.