You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Motivation
Good unit tests are independent and isolated. When tested component requires some input data, like model, that data should be mocked, not produced by other real components (like e.g. adaptors) directly in the test. Doing that would introduce inter-dependency and make test not fully "unit" test. On the other hand relaying always on synthetic data makes us unsure whether components are compatible with each other. This ticket describes proposal of solution of that problem.
The idea is to define simple way of describing model structure, e.g. using json-like js object and keep those definitions next to unit tests (but not directly in unit-test files as they are intended to be accessed from multiple tests):
It would create the ability to define such model descriptions for components both consuming and providing models, like adaptors or views.
Once defined the schema can be used in following way to assure consistency and interoperability of components regarding exchanged data:
test model data used in component's unit test should be checked if match the defined schema
unit test should verify if component (adaptors) output model matches the defined schema
separate unit test should verify if schema of two components used together in the application match each-other
The checks could be done by dedicated testing utility, e.g.
// checks if given model is compliant with schemaModelSchemaVerification.verifyModel(model, schema)
// checks if two schemas are compatible (e.g. adaptor's output and view's input)ModelSchemaVerification.checkSchemasCompatibility(schemaA, schemaB)
This approach could give ability of testing component's interoperability on model data level, but with good isolation within particular unit-tests.
Description
Motivation
Good unit tests are independent and isolated. When tested component requires some input data, like model, that data should be mocked, not produced by other real components (like e.g. adaptors) directly in the test. Doing that would introduce inter-dependency and make test not fully "unit" test. On the other hand relaying always on synthetic data makes us unsure whether components are compatible with each other. This ticket describes proposal of solution of that problem.
The idea is to define simple way of describing model structure, e.g. using json-like js object and keep those definitions next to unit tests (but not directly in unit-test files as they are intended to be accessed from multiple tests):
It would create the ability to define such model descriptions for components both consuming and providing models, like
adaptors
orviews
.Once defined the schema can be used in following way to assure consistency and interoperability of components regarding exchanged data:
The checks could be done by dedicated testing utility, e.g.
This approach could give ability of testing component's interoperability on model data level, but with good isolation within particular unit-tests.
The diagram depicting the flow can be found here: https://miro.com/app/board/uXjVLdeD6fs=/
The text was updated successfully, but these errors were encountered: