Concordia Language
Informal specification
Line comments
Common line comment
It makes the compiler to ignore a piece of text. Example:
Special line comment
They are:
#language: <value>
defines the document's language, where<value>
is an available language such asen
(English) orpt
(Portuguese).#locale: <value>defines document's locale, where<value>is an available local such asen-US(USA English) orpt-BR(Brazilian Portuguese).NOT AVAILABLE YET.
Example:
Tag
A tag adds metadata to a declaration.
A tag starts with @
. Multiple tags can be declared in a single line. Examples:
Some tags can receive parameters. Examples:
Special tag
A special tag changes the compiler's behavior. These are special tags:
@importance( <number> )
: indicates the importance of a declaration. The importance is as high as its number.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
A Feature can be a piece of functionality or some needed, wished or distinguish characteristic of a system.
Example:
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:
In the above example the benefit to the business is to prevent unauthorized access.
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
Remove any (
Then
) sentences with a produced State; andReplace any (
Given
orWhen
) sentences with a required State by sentences from the Variant that can produce it.
Let's say that we have a simple Login feature like this:
Now let's suppose that a user has to be logged in to access its account details:
Scenario
High-level, business-focused, usage scenario of a Feature.
Example:
Template:
Variant
Test-oriented declaration that describes a possible interaction between a user and the system in order to accomplish a Scenario.
Example:
Things that can be part of Variant sentences:
Values such as
"bob@example.com"
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 singleWhen
and a singleThen
sentence. Useand
for the other sentences.Write a single action per sentence.
Do not use
and
in 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:
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>
//
When I click on <//form/div/button[1]>
(none)
To find a widget by its type.
When I click on <button>
Constants
Declaration block with constant values
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:
Constant values are accessible by their names between [
and ]
. Examples for the constants above:
Table
Defines a data table that can be used by UI Elements' properties.
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:
Database
Declares a database connection that can be used for test data selection
Example 1:
Example 2:
Properties:
type
Yes
host
URL that indicates where the database is hosted.
Vary
port
Network communication port used to connect to the database. Whether not defined, the default database port will be used, according to the property type
.
No
name
Database name. Used when there is a database server (whose location is defined by the property host
) and the database is accessible by its name.
Vary
path
Database path. Used when the database is accessed through the file system, such as the types csv
, ini
, json
, sqlite
and xlsx
.
Vary
username
Username used to connect to the database. When not defined, the database's default user will be used, according to the property type
.
No
password
Password used to connect to the database. When not defined, the database's default password will be used, according to the property type
.
No
options
Database-specific connection options.
No
UI Element
Import
Imports declarations from a
.feature
file
Examples:
Test Case
Test Events
Last updated