'from' clause
The from clause specifies what type of models from which the select clause will gather its values. The from clause can take class objects defined in CukeModeler as well as shorthand versions thereof. The following are some example values:
CukeModeler::Outline (exact class) outline (singular) outlines (pluralized)
Sample usage: cql_repo.query do select name from scenarios end
This clause can be repeated multiple times. The arguments for successive clauses are simply added to the previous arguments.
Background: A sample Cucumber suite
- Given a directory "
test_directory" - And a file "
test_directory/test_file_1.feature":gherkinFeature: A test feature Scenario: Test 1 * some steps @special_tag Scenario: Test 2 * some other steps Scenario Outline: Test 3 * some steps Examples: First examples | param | | value | Examples: Second examples | param | | value | - And a repository is made from "
test_directory"
Scenario: Using 'from' to specify what kind of objects from which to return attributes
- When the following query is executed:
select name from scenarios - Then the following values are returned:
name Test 1 Test 2 - When the following query is executed:
select name from outlines - Then the following values are returned:
name Test 3
Scenario: Gathering from multiple sources
- When the following query is executed:
select name from scenarios, outlines - Then the following values are returned:
name Test 1 Test 2 Test 3
Scenario: Using the shorthand form of class names
- When the following query is executed:
select name from CukeModeler::Scenario - Then the result is the same as the result of the following query:
select name from scenario - And the result is the same as the result of the following query:
select name from scenarios
Scenario: Using the 'from' clause multiple times
Note: Selecting from different types of model should be done with care since problems can occur if the attributes specified by the 'select' clause do not exist on all of the models specified by the 'from' clause
- When the following query is executed:
select name from scenarios from outlines - And the result is the same as the result of the following query:
select name from scenarios, outlines
Source: features/clauses/from_clause.feature at commit 34893a52, Cql (MIT license).