| 1 |
.. _functional_validation: |
| 2 |
|
| 3 |
Functional validation |
| 4 |
===================== |
| 5 |
|
| 6 |
.. meta:: |
| 7 |
:description: Validation in DataLab, the open-source scientific data analysis and visualization platform |
| 8 |
:keywords: DataLab, scientific, data, analysis |
| 9 |
|
| 10 |
Strategy |
| 11 |
-------- |
| 12 |
|
| 13 |
DataLab functional validation is based a classic test strategy, with a strong emphasis |
| 14 |
on automated testing. Apart from one or two manual tests (e.g. load test), all tests |
| 15 |
are automated (more than 99% of the tests are automated). |
| 16 |
|
| 17 |
Writing tests follows the TDD (Test-Driven Development) principle: |
| 18 |
|
| 19 |
- When *a new feature is developed*, the developer writes the tests first. The tests |
| 20 |
are then executed to ensure that they fail. The developer then implements the feature, |
| 21 |
and the tests are executed again to ensure that they pass. |
| 22 |
|
| 23 |
- When *a bug is reported*, the developer writes a test that reproduces the bug. |
| 24 |
The test is executed to ensure that it fails. The developer then fixes the bug, |
| 25 |
and the test is executed again to ensure that it passes. |
| 26 |
|
| 27 |
Depending on the abstraction level, unit tests and/or application tests are written. |
| 28 |
When writing both types of tests, the developer starts with the unit tests and then |
| 29 |
writes the application tests. |
| 30 |
|
| 31 |
Types of tests |
| 32 |
-------------- |
| 33 |
|
| 34 |
The functional validation of DataLab is based on two main types of tests: |
| 35 |
|
| 36 |
- **Unit tests** (test scripts named ``*_unit_test.py``): Test individual functions or |
| 37 |
methods. All unit tests are automated. |
| 38 |
|
| 39 |
- **Application tests** (test scripts named ``*_app_test.py``): Test the interaction |
| 40 |
between components (integration tests), or the application as a whole. |
| 41 |
All application tests are automated. |
| 42 |
|
| 43 |
Implementation |
| 44 |
-------------- |
| 45 |
|
| 46 |
The tests are implemented using the `pytest <https://docs.pytest.org/en/latest/>`_ |
| 47 |
framework. Many existing tests may be derived from to create new tests. |
| 48 |
|
| 49 |
Executing tests |
| 50 |
--------------- |
| 51 |
|
| 52 |
To execute the tests, the developer uses the command line interface. |
| 53 |
See section :ref:`run_functional_validation_tests` for more information on how to run |
| 54 |
functional validation tests. |