Concordia Language
Informal specification

Line comments

Common line comment

It makes the compiler to ignore a piece of text. Example:
1
# This is a comment
2
3
Feature: Pay with Credit Card # This is also a comment
Copied!

Special line comment

  • Local declaration.
  • At most one declaration per file.
  • Take precedence over a CLI option or configuration file option.
They are:
  • #language: <value> defines the document's language, where <value> is an available language such as en (English) or pt (Portuguese).
  • #locale: <value> defines document's locale, where <value> is an available local such as en-US (USA English) or pt-BR (Brazilian Portuguese). NOT AVAILABLE YET.
Example:
1
#language: pt
2
3
Funcionalidade: Pagar com Cartão de Crédito
Copied!

Tag

A tag adds metadata to a declaration.
  • Local declaration.
  • Allowed more than one tag per language construction.
A tag starts with @. Multiple tags can be declared in a single line. Examples:
1
...
2
3
@critical @slow
4
Feature: Print Coupon
5
6
...
7
8
@gui
9
Variant: Print to PDF
10
...
11
12
@device
13
Variant: Print to Plotter
14
Copied!
Some tags can receive parameters. Examples:
1
@importance( 6 )
2
Feature: Register Employee
3
...
4
5
6
@extends( Date )
7
UI Element: Birth Date
8
...
Copied!

Special tag

A special tag changes the compiler's behavior. These are special tags:
  • @scenario( <number> ): references a Scenario by its index, starting at 1.
  • @variant( <number> ): references a Variant by its index, starting at 1.
  • @importance( <number> ): indicates the importance of a declaration. The importance is as high as its number.
  • @generated: indicates that a Test Case was computer-generated.
  • @fail: indicates that a Test Case should fail.
  • @ignore: whether applied to a Variant, the Variant will not produce Test Cases; whether applied to a Test Case it will not produce test scripts.
  • @generate-only-valid-values: avoids that a UI Element's property be used for generating values considered invalid. This is specially useful for using with masked input fields, in which the system does not let a user to type invalid characters on it. For instance:
    1
    UI Element: Year
    2
    - data type is integer
    3
    @generate-only-valid-values
    4
    - format is "/^[0-9]{1-3}$/"
    5
    Otherwise I must see "Year must be a number."
    Copied!
    The above example will avoid generating invalid input values (e.g., "A") for testing the format of the Year.
Reserved for future use:
  • @global makes a UI Element globally accessible. Global UI Elements must not have the same name. Local UI Elements (the default) overrides global UI Elements.
  • @extends( <name> )

Common tag

A common tag is ignored by the compiler and aims to provide meaningful metadata for a declaration. Any tag that is not a special tag is considered a common tag. Examples:
  • @critical may indicate that the current feature is critical for the project;
  • @issue(20) may indicate that a feature (or scenario or variant) is being implemented in the Issue 20 from the Issue control system.

Feature

Desired behavior of a software system
  • Global declaration with unique name, at most one declaration per file.
  • Sentences are optional and are not used for generating test cases.
  • Business-oriented sentences, written as a User Story.
A Feature can be a piece of functionality or some needed, wished or distinguish characteristic of a system.
Example:
1
Feature: Administrator Login
Copied!
Feature sentences should try to describe the contribution that the Feature brings to the business addressed by the software system. They are optional, but recommended. Example:
1
Feature: Login
2
As a registered user
3
I would like to access to the system using my credentials
4
So that the system prevents unauthorized access
Copied!
In the above example the benefit to the business is to prevent unauthorized access.
Concordia adopts a wide-spread template for describing them: User Story. A User Story template goes like this:
1
As a <role>
2
I would like to <capability>
3
So that <benefit>
Copied!
The order of the sentences can vary. A <role> is usually a type of user or stakeholder. A <capability> is what the role wants to perform in order to achieve the <benefit>, which often is the contribution to the business.

State

A certain state of the system
  • Local declaration, only accepted insideVariantsentences.
  • Used for generating test cases.
A State is denoted by a text between tilde (~), such as ~a state~, and must be written inside Variant sentences. Example:
1
Then I have a ~user logged in~
Copied!
A Variant can both produce or require states. A State is produced by a Then sentence, like in the prior example. A State is required by a Given or a When sentence. For instance:
1
Given that I have ~user logged in~
Copied!
By declaring a required State, you're establishing a dependency among the current Variant and the ones that can produce it. Since that State is often produced by a Variant from another Feature, you have to import the corresponding Feature file. Concordia Compiler will only search for states from imported Feature files.
When transforming Variants into Test Cases, Concordia Compiler will:
  • Remove any (Then) sentences with a produced State; and
  • Replace any (Given or When) sentences with a required State by sentences from the Variant that can produce it.
Whether there are different Variants that can produce a (same) required State, Concordia Compiler will be able to combine each of them with the current Variant, aiming to produce Test Cases that explore different execution paths. For more information, please read the section Test Coverage and Techniques.
Let's say that we have a simple Login feature like this:
login.feature
1
Feature: Login
2
3
Scenario: Sucessful login
4
5
Variant: Login with username and password
6
Given that I am on the [Login Screen]
7
When I enter with "bob" in {Username}
8
and I enter with "123456" in {Password}
9
and I click on {OK}
10
Then I see "Welcome"
11
and I have ~user logged in~
12
13
14
Constants:
15
- "Login Screen" is "/login"
16
17
UI Element: Username
18
19
UI Element: Password
20
21
UI Element: OK
22
- type is button
Copied!
Now let's suppose that a user has to be logged in to access its account details:
my-account.feature
1
import "login.feature"
2
3
Feature: My Account
4
5
Scenario: See my account data
6
7
Variant: Show basic data by default
8
Given that I have ~user logged in~
9
and I am on the [Account Screen]
10
Then I see {User} with "bob"
11
and I see {Name} with "Robert Downey Jr"
12
13
14
Constants:
15
- "Account Screen" is "/account"
16
17
UI Element: User
Copied!
Concordia Compiler will produce my-account.testcase with a Test Case like the following, that includes sentences from both the features:
1
import "my-account.feature"
2
3
@scenario(1)
4
@variant(1)
5
Test Case: See my account data - 1
6
Given that I am on the "/login"
7
When I enter with "bob" in <username>
8
and I enter with "123456" in <password>
9
and I click on <ok>
10
Then I see "Welcome"
11
Given that I am on the "/account
12
Then I see <user> with "bob"
13
and I see <name> with "Robert Downey Jr"
Copied!

Scenario

High-level, business-focused, usage scenario of a Feature.
  • Local declaration with a unique name.
  • One or more declarations per Feature.
  • Sentences are optional and are not used for generating test cases.
  • Business-oriented sentences that follow the template Given-When-Then.
Example:
1
Feature: Sales Report
2
3
Scenario: Daily sales report
4
Given that I am authenticated as a manager
5
When I open the sales report
6
and I choose the option "Daily report"
7
Then I see a list with all the today's sales
8
and the total value
Copied!
Template:
1
Given <some context or precondition>
2
and <other context or precondition>
3
and <other context or precondition>
4
...
5
When <some action is carried out>
6
and <other action is carried out>
7
and <other action is carried out>
8
...
9
Then <a result or postcondition is observed>
10
and <another result or postcondition is observed>
11
and <another result or postcondition is observed>
12
...
Copied!

Variant

Test-oriented declaration that describes a possible interaction between a user and the system in order to accomplish a Scenario.
  • Local declaration, one or more per Scenario.
  • Sentences are used for generating test cases.
  • Test-oriented sentences that follow the template Given-When-Then and first-person singular ("I").
A Variant must use the Given-When-Then template (see Scenario) and first person singular ("I") in its sentences. Concordia Compiler uses Natural Language Processing (NLP) techniques to understand them and convert them to the available actions. Example:
1
Feature: New User
2
3
Scenario: Successful registration
4
5
Variant: Register with a new account
6
Given that I am on the [New Account Screen]
7
When I fill {Name}
8
and I fill {Date of Birth}
9
and I enter with "[email protected]" in <#email>
10
and I inform 123 in <#pass>
11
and I type 123 in <#confirmation>
12
and I click <#ok>
13
Then I have a ~registered user~
14
and I see "Welcome, Bob"
15
16
...
Copied!
Things that can be part of Variant sentences:
  1. 1.
    References to Constants, such as [New Account Screen]
  2. 2.
    References to UI Elements, such as {Name} or {New User:Name}.
  3. 3.
    Widgets, such as <#ok>
  4. 4.
    States, such ~registered user~
  5. 5.
    Values such as "[email protected]"
  6. 6.
    Numbers such as 123

Best practices

  • Make sure that your preconditions are part of the group with Given sentences.
  • Make sure that your actions are part of the group with When sentences.
  • Make sure that your post-conditions are part of the group with Then sentences.
  • Whenever possible, use a single Given , a single When and a single Then sentence. Useand for the other sentences.
  • Write a single action per sentence.
  • Do not use andin the middle of a sentence (break it, instead).
  • Use an additional indentation for and sentences.

Widgets

Variant sentences can have widgets (of the user interface) denoted between < and >. Example:
1
When I fill <#firstName> with "Alice"
Copied!
Concordia adopts the well-known CSS query selectors to locate widgets. Plugins convert these selectors to the format adopted by the testing framework.
Available locators:
Locator
Purpose
Example
#
To find a widget by its id.
When I click on <#save>
.
To find a widget by its class.
When I click on <.btn-primary>
@
To find a widget by its name.
When I click on <@save>
~
To find a widget by its mobile name.
When I click on <~save>
//
To find a widget by its XPath.
When I click on <//form/div/button[1]>
(none)
To find a widget by its type.
When I click on <button>
Whether you are testing a web application, you may find Katalon-Concordia useful. It's a browser extension - available for Google Chrome and Mozilla Firefox - that extends Katalon Recorder to save a recorded interaction as Variant sentences. Using it may reduce the time needed to locate the widgets of an existing application.

Constants

Declaration block with constant values
  • Global declaration (can be used by other files).
  • At most one declaration per file.
  • Constants cannot have the same name of a Table or a Database.
A Constants block can define one or more constants, preceded by a dash sign (-). Both constant names and values are declared between quotes, except for numeric values - that can be declared without quotes. Example:
1
Constants:
2
- "Home" is "/home"
3
- "App Name" is "Acme"
4
- "Mininum Age" is 18
5
- "Pi" is 3.1416
Copied!
Constant values are accessible by their names between [ and ]. Examples for the constants above:
1
Variant: Example
2
Given that I visit [Home]
3
and I see [App Name]
4
# ...
5
6
UI Element: Age
7
- minimum value is [Minimum Age]
8
Otherwise I see "Invalid age."
9
10
UI Element: Some Math Value
11
- maximum value is [Pi]
Copied!

Table

Defines a data table that can be used by UI Elements' properties.
  • Global declaration (can be used by other files).
  • Zero, one or many declarations per file.
  • Tables cannot have the same name of a Constant or a Database.
A table must have a unique name. Their rows are denoted between pipe (| ). The first row must provide the column names. Other rows must provide the corresponding data. Example:
1
Table: professions
2
| name | min_salary |
3
| Magician | 100000.00 |
4
|
Copied!
Table declarations are transformed into in-memory tables that can be queried by UI Element properties for selecting test data. Tables can be queried using SQL. Like Constants, their names must be referenced between [ and ]. Example:
1
UI Element: Profession
2
- value comes from "SELECT name FROM [professions]"
3
4
UI Element: Salary
5
- minimum value comes from "SELECT min_salary from [professions] WHERE name = {Profession}"
Copied!

Database

UI Element

Import

Imports declarations from another file
  • Local declaration.
  • Give access to the declarations from the imported file.
Examples:
1
import "file1.feature"
2
import "path/to/file2.feature"
Copied!

Test Case

Test Events

Last modified 7mo ago