Skip to content
A query language for Gherkin
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Bump gem version Jun 20, 2018
.cucumberproignore Filtering test files from documentation Jun 24, 2017
.travis.yml Remove Ruby 1.9.3 from OSX CI Dec 16, 2017
Gemfile Revert "Limit Ruby versions for dev" Jun 16, 2018 Update history document Jun 20, 2018
LICENSE.txt Update project license Jan 2, 2018 Include Cucumber Pro in Readme Dec 31, 2017
appveyor.yml CI build coverage update May 18, 2017
cql.gemspec Fix a typo in the gemspec Jun 18, 2018

Gem Version Dependency Status Build Status Build status Coverage Status Code Quality Yard Docs Inline docs Project License

CQL (Cucumber Query Language)

CQL is a domain specific language used for querying a Cucumber (or other Gherkin based) test suite. It is written in Ruby and powered by the cuke_modeler gem. The goal of CQL is to increase the ease with which useful information can be extracted from a modeled test suite and turned into summarized data or reports.

Some uses for example are:

  • Build systems
  • Reporting

Quick Start

  • Install the gem

Use the following command:

gem install cql

Alternatively you can add it to your Gemfile if you are using bundler.

  • Create a new ruby file and require the gem

      require 'cql'
  • Start querying things!

The first thing that needs to be done is to create a CQL Repository. This can be done with the following line:

require 'cql'
cql_repo = "/path-to/my/feature-files"

Repositories can also be created from an existing model:

directory ="/path-to/my/feature-files")
cql_repo =

Now that you have a repository you can write a query. A simple example is given below

cql_repo.query do
    select name, source_line
    from features

This will return a list of all of the feature names and source lines in the form of a list of hashes.

[{'name' => 'Feature 1', 'source_line' => 1},
 {'name' => 'Feature 2', 'source_line' => 3},
 {'name' => 'Feature 3', 'source_line' => 10}]

Alternatively, you can activate the extensions to the cuke_modeler gem and query models directly:

require 'cql'
require 'cql/model_dsl'

directory ="/path-to/my/feature-files")

directory.query do
    select name, source_line
    from features

For more information on the query options, see the documentation here (current home) or here (future home).

You can’t perform that action at this time.