Skip to content
Snippets Groups Projects
Commit 5f2e677b authored by MJB's avatar MJB
Browse files

updated readme with initial testing conventions

parent 5ed121cf
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,24 @@ https://gitlab.it-innovation.soton.ac.uk/mjb/flame-clmc/blob/integration/docs/ad
tbd
#### Creating a fixture
#### Testing
Testing is implemented using pytest.
The installation script is here:
`test/services/pytest/install.sh`
using the following convention:
* Tests are written in python using pytest
* Related tests are stored in a python module `test/<testmodule>` to create a suite of tests. All tests are stored in files test_*.py, there can be many tests per file, and many files per module
* Each test module has a rspec.yml that provides the baseline "fixture" for the tests in the module
* Tests are executed against fixtures. Fixtures are modular "setups" created for a test, that are inserted into the python code using dependancy injection. This offers more flexibility than the *unit style testing. The baseline deployment is created using `vagrant up` with an appropriate rspec, and the pytest fixture reads the rspec.yml and makes the configuration available to the test.
* Tests are executed from a guest VM (not the host) in the repo root using the command `pytest test/<testmodule>`
* Pytest will scan the directory for all tests including in files test_*.py and run them
#### Creating a deployment for a test
To set up a simualtion of the adaptive streaming use case scenario
......@@ -64,7 +81,9 @@ The **clmc-service** vm includes influx, Kapacitor and Chronograf. The following
* Chronograf: 8888
* Kapacitor: 9092
#### Running the simulation using the fixture
#### Running the streaming-sim test
**needs to be updated once we have this in pytest format**
SSH into the CLMC server
......
import pytest
import yaml
@pytest.fixture(scope="module")
def streaming_sim_config():
@pytest.fixture(scope="module",
params=['test/streaming-sim/rspec.yml'])
def streaming_sim_config(request):
"""Returns the service configuration deployed for the streaming simulation test. In future this needs to be a parameterised fixture shared with other rspec.yml based tests"""
with open("test/streaming-sim/rspec.yml", 'r') as stream:
print(request.param)
with open(request.param, 'r') as stream:
data_loaded = yaml.load(stream)
return data_loaded
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment