Flowman Test Execution#
The different aspects of each test are execution in a specific order by Flowman.
A test environment is set up by adding or modifying any variable specified in the
environmentsectionAll relations and mappings specified as overrides are created to replace and extend the original entities.
All
targetsandfixturesare executed. Data dependencies are used to determine a correct execution order. The execution includes theCREATE,BUILDandVERIFYphases.All
assertionsare executedAll
targetsandfixturesare cleaned up by executing theDESTROYphase.
Example#
tests:
common_fixtures:
overrideMappings:
mapping_a:
kind: mock
records:
- [1,"cat","black"]
- [2,"dog","brown"]
overrideRelations:
raw_data:
kind: mock
records:
- "042599999963897201301010000I"
test_aggregation:
description: "Test all aggregations"
extends:
- common_fixtures
environment:
- some_value=12
targets:
- build_cube
fixtures:
prepare_additional_data:
kind: relation
relation: additional_data
mapping: mapping_a
assertions:
measurements_extracted:
kind: sql
description: "Measurements are extracted correctly"
tests:
- query: "SELECT * FROM measurements_extracted"
expected:
- [1,63897,999999,10.6,2013-01-01,0.9,1,124,CRN05,1,0000,H]
- [1,63897,999999,10.6,2013-01-01,1.5,1,124,CRN05,1,0005,H]
- query: "SELECT COUNT(*) FROM measurements_extracted"
expected: 2
In the example above, the following steps are executed:
A new execution environment is created containing all original variables plus the
some_valuevariable.The override mapping
mapping_aand override relationraw_dataare added to the execution environment.The targets and fixtures
build_cubeandprepare_additional_dataare executed with phasesCREATE,BUILDandVERIFY.The assertion
measurement_extractedis run with all tests executed.The targets and fixtures
build_cubeandprepare_additional_dataare cleaned up with phaseDESTROY.