From 3ed1180669e15b8f96d62976c1a8d5ef77b114be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hunor=20Csomort=C3=A1ni?= Date: Thu, 30 Jan 2020 15:36:05 +0100 Subject: [PATCH] Document integration test case and test environment design MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the integration test README to explain the design of the test case and test environment code. This should help future contributors. Signed-off-by: Hunor Csomortáni --- tests/integration/README.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/integration/README.rst b/tests/integration/README.rst index 48fc90b6..6267ea6a 100644 --- a/tests/integration/README.rst +++ b/tests/integration/README.rst @@ -40,4 +40,26 @@ have 4 tests running in parallel one could call:: MBS_TEST_WORKERS=4 tox -e integration +Test case and test environment design +===================================== + +Currently each test case is implemented in a separate file. + +Test cases interact with the test environment, test configuration, and service +under test (SUT) through fixtures. These are defined in `conftest.py`_, and +`pytest takes care`_ to create them. + +These fixtures usually instantiate a class from `utils.py`_. These classes are +intended to wrap the services or data the test cases need to interact with. +This wrapping creates a layer of abstraction which makes the test cases more +readable, and should also make updates easier, in case those services or data +change in the future. + +Test cases should check for preconditions (if any) in the test data and test +environment. This helps to better understand test failures and debug failing +test cases. + .. _tests/integration/example.test.env.yaml: example.test.env.yaml +.. _conftest.py: conftest.py +.. _pytest takes care: https://docs.pytest.org/en/latest/fixture.html#conftest-py-sharing-fixture-functions +.. _utils.py: utils.py