Skip to main content

Posts

Showing posts from January, 2018

Testing Against External Processes with pytest-xprocess

Introduction With the advent of micro-services or simply componentization of complex applications, more often than not it is a good idea to write at least few integration tests to make sure that different components can interact in the intended way. However, these components may run in their own process, may take some time to start-up, and may require other processes to be run first. This article aims to give some ideas on how to solve the following problems, using pytest:  How to start an external process before the tests run, and make sure tests start running only once the process is fully initialized? Starting an external process is usually resource and time consuming, how can the whole test suite be setup to run the external process only once before all tests run, and shutdown only once all tests are completed? Given a system under test (SUT), which depends on a process A, which in turn depends on a process B, how can all the processes be start in the correct order befor...