Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
VIATRA/Query/UserDocumentation/QueryTestFramework
< VIATRA | Query
Revision as of 07:54, 31 March 2016 by Unnamed Poltroon (Talk) (Viatra Query test framework user documentation - first draft)
Query Test Framework
There is a test framework available specifically designed to test Viatra Queries. It was developed with the following use cases in mind:
- Testing the Viatra Query Engine itself
- Provide a regression testing framework for users to test patterns
Basic concepts
The framework allows the user to compare the results of a pattern execution using different engine implementation or to a predefined result set (so-called snapshot). It defines a convenient internal DSL to define test cases. A description of a test case consists of the following parts:
- What to test
- Generated query specifications
- Pattern groups
- Generic pattern groups (possible parsed directly from .vql files)
- Input models
- Execution methods
- by Rete or LocalSearch engines
- from snapshot
- Assumption (optional)
- Checks whether all given execution method supports the given patterns (i.e. the test case is applicable)
- Assertion
- Checks whether the results provided by all execution methods are the same for each patterns.
Example:
ViatraQueryTest. //Entry point test(SomeQuerySpecification::instance).and(AnotherQuerySpecification). // Patterns under test on(modelURI). // Load instance models (this may be optional if a snapshot model references the used input model) with(snapshot). // Compare prepared results stored by a snapshot model with(new ReteBackendFactory). // Compare results produced by the Rete engine assertEquals // make assertions