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
environment
sectionAll relations and mappings specified as overrides are created to replace and extend the original entities.
All
targets
andfixtures
are executed. Data dependencies are used to determine a correct execution order. The execution includes theCREATE
,BUILD
andVERIFY
phases.All
assertions
are executedAll
targets
andfixtures
are cleaned up by executing theDESTROY
phase.
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_value
variable.The override mapping
mapping_a
and override relationraw_data
are added to the execution environment.The targets and fixtures
build_cube
andprepare_additional_data
are executed with phasesCREATE
,BUILD
andVERIFY
.The assertion
measurement_extracted
is run with all tests executed.The targets and fixtures
build_cube
andprepare_additional_data
are cleaned up with phaseDESTROY
.