Logo: Relish

  1. Sign in

Project: Cql 1.2.1

'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":
Feature: 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"
Scenarios
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
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
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
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

Last published about 5 years ago by Eric Kessler.