arrow-left
All pages
gitbookPowered by GitBook
1 of 1

Loading...

Quick Start

Welcome to the Concordia 2 documentation! This page will help you to get started fast. If you run into problems, you can find help on our Slack channelarrow-up-right.

circle-info

See Understanding Concordia in case you don't know it yet.

hashtag
System Requirements

Concordia Compiler requires only version 12.20 (or above) and works on Linux, MacOS and Windows.

In this Quick Start, we'll create a simple specification of an interaction with a search page and use . Therefore, download it before continuing.

hashtag
Step 0: Initialize

If you are starting a new project or whether your project does not have a file named package.json, then run:

circle-info

You can use NPM, Yarn or PNPM.

hashtag
Step 1: Install

Install Concordia Compiler :

triangle-exclamation

It will install version 2 that is in alpha stage, although stable.

circle-exclamation

Note that the needed package name is concordialang (with lang). After installing it, we'll always use npx concordia to execute it.

hashtag
Step 2: Configure

Concordia Compiler will ask you about some preferences. Press Enter to answer every question with their default values. It will create a configuration file named .concordiarc and install the selected and .

hashtag
Step 3: Create a feature

Create the folderfeatures :

Now create the file search.feature withinfeatures, with the following content:

About the file:

  • Feature and Scenario are high-level, business-focused descriptions about the problem to solve. Their sentences are not used to generate test cases. The above example does not describe them.

  • A Variant describes the expected interaction with the application's user interface (UI) in order to perform a Scenario. Thus, a Variant uses technological vocabulary.

  • In Concordia, all the interactions with the UI use first person singular ("I"). That "I" represents the actor that is interacting with the application (in the example above, a visitor).

hashtag
Step 4: Execute

Finally, run

circle-check

✨ That's it. Congratulations!✨

It will:

  • set the testing environment up (once);

  • generate a test case file and transformed it into a test script file;

  • execute the test script file; and

  • report the test script results.

Your browser should open automatically during this process and the console will report the execution results.

Your directory should now look like this:

The directory node_modules contains installed dependencies, like tools and frameworks, whose versions are managed with package.json and package-lock.json. The file codecept.json has a basic configuration to run CodeceptJS with Google Chrome and you can to fit your needs.

The file features/search.testcase should look like this:

The Test Case above was produced from the Variant declared in features/search.feature. Some notes about it:

  • The import clause (line 5) imports the declared file's content.

  • The tag @generated (line 7) indicates that the Test Case was produced automatically.

  • The tag @scenario(1) (line 8) indicates that the Test Case belongs to the first Scenario (1).

The file test/search.js contains the test script produced from features/search.testcase using the selected plug-in. It also contains line comments with references to their corresponding lines and columns in the .testcase file:

circle-info

Concordia Compiler can also generate and for you. All the test cases and test scripts receive line comments that detail the and reference declarations used to produce oracles and test data.

hashtag
Notes on installation options

You can opt to install Concordia Compiler locally (per project) or globally.

hashtag
Local installation (recommended)

  • does not require administrative privileges (i.e., using sudo on Linux or MacOS) to install;

  • allows every project to have its own, independent installation;

  • demands using before every command.

Follow the for a install installation.

circle-info

is included in NodeJS 8.2.0 or above.

Global installation

  • requires administrative privilegies (i.e., using sudo on Linux or MacOS) to install;

  • lets you execute the compiler direcly from any folder;

  • needs more attention when upgrading, especially for plug-ins.

Example:

Note: On Windows, you must omit sudo.

Additional tips:

  • .

  • Whether Windows requires administrative privileges to install, right click Windows (Start) menu, click "Command Prompt (Admin)" or alternatively "Windows PowerShell (Admin)", and then proceed with the installation command.

  • To upgrade Concordia later, change the installation command from install to upgrade.

hashtag

hashtag

The tag @variant(1) (line 9) indicates that the Test Case belongs to the first Variant (1) of the Scenario declared previously.

  • The Test Case (line 10) is named using the Variant's name plus dash (-) and some (incremental) number. Its content is basically the same as the Variant's, since we did not use any other declarations.

  • NodeJSarrow-up-right
    Google Chromearrow-up-right
    locally
    plug-in
    database drivers
    change itarrow-up-right
    test dataarrow-up-right
    test oraclesarrow-up-right
    kind of data test case being explored
    NPXarrow-up-right
    Quick Start
    NPXarrow-up-right
    How to install globally with NPM on Linux or MacOS without sudoarrow-up-right
    npm init --yes
    npm i -D concordialang
    npx concordia --init
    mkdir features
    Feature: Search
    
    Scenario: Shows results that correspond to the term
    
      Variant: Search by pressing Enter
        Given that I am on "https://google.com"
        When I type "concordialang" in <q>
          And I press "Enter"
          And I wait for 2 seconds
        Then I see "npm"
    npx concordia
     ┃
     ┣ features/          
     ┃ ┣ search.feature
     ┃ ┗ search.testcase     🡐 generated test case
     ┣ node_modules/
     ┣ test/              
     ┃ ┗ search.js           🡐 generated test script
     ┣ .concordiarc
     ┣ codecept.json
     ┣ package.json  
     ┗ package-lock.json
    # Generated with ❤ by Concordia
    #
    # THIS IS A GENERATED FILE - MODIFICATIONS CAN BE LOST !
    
    import "search.feature"
    
    @generated
    @scenario(1)
    @variant(1)
    Test Case: Search by pressing Enter - 1
      Given that I am on "https://google.com"
      When I type "concordialang.org" in <q>
        And I press "Enter"
        And I wait for 2 seconds
      Then I see "npm"
    // Generated with ❤ by Concordia
    // source: search.testcase
    //
    // THIS IS A GENERATED FILE - MODIFICATIONS CAN BE LOST !
    
    Feature("Search");
    
    Scenario("Shows results that correspond to the term | Search by pressing Enter - 1", (I) => {
        I.amOnPage("https://google.com"); // (11,2)
        I.fillField("q", "concordialang.org"); // (12,2)
        I.pressKey("Enter"); // (13,4)
        I.wait(2); // (14,4)
        I.see("npm"); // (15,2)
    });
    
    sudo npm install -g concordialang
    concordia --version