Skip to content

veepee-oss/gingerspec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


  /$$$$$$  /$$                                          /$$$$$$                               
 /$$__  $$|__/                                         /$$__  $$                              
| $$  \__/ /$$ /$$$$$$$   /$$$$$$   /$$$$$$   /$$$$$$ | $$  \__/  /$$$$$$   /$$$$$$   /$$$$$$$
| $$ /$$$$| $$| $$__  $$ /$$__  $$ /$$__  $$ /$$__  $$|  $$$$$$  /$$__  $$ /$$__  $$ /$$_____/
| $$|_  $$| $$| $$  \ $$| $$  \ $$| $$$$$$$$| $$  \__/ \____  $$| $$  \ $$| $$$$$$$$| $$      
| $$  \ $$| $$| $$  | $$| $$  | $$| $$_____/| $$       /$$  \ $$| $$  | $$| $$_____/| $$      
|  $$$$$$/| $$| $$  | $$|  $$$$$$$|  $$$$$$$| $$      |  $$$$$$/| $$$$$$$/|  $$$$$$$|  $$$$$$$
 \______/ |__/|__/  |__/ \____  $$ \_______/|__/       \______/ | $$____/  \_______/ \_______/
                         /$$  \ $$                              | $$                          
                        |  $$$$$$/                              | $$                          
                         \______/                               |__/                          

GingerSpec pipeline Maven Central License GitHub Release Date javadoc

Acceptance Test library. General purpose automation framework.

Intro | Documentation | Requirements | Technologies | Using GingerSpec | Aspects | Steps | Contribute

Project Intro/Objective

The purpose of this project is to provide a generic BDT (behaviour driven testing) library with common BDD steps and extended gherkin language.

GingerSpec provides common functionality that can be reused by different test projects, It encourages code reusability, as we test (in most of the cases) the same, it will help our QA Community to get our objectives much faster. It focuses on the reuse of actions (also steps or key tabs) that implement low level functionality and that can be organized to create much more complex features.


GingerSpec Highlights

Documentation

Requirements

  • Java 8+
  • Maven 3+

Technologies

  • Cucumber for test definition
  • TestNG for execution
  • Selenium
  • Appium
  • AssertJ
  • SQL (PostgreSQL, MySQL, Clickhouse)
  • rest-assured (Rest API testing)
  • GraphQl
  • Swagger (2.x, 3.x)
  • SSH support
  • Files manipulation
  • WebServices (SOAP)
  • Kafka & ZooKeeper

Using GingerSpec

We strongly suggest to make use of the special archetype for GingerSpec based projects: gingerspec-starter. Just run the following command in your terminal (replace the values for groupId, version and artifactId as needed):

mvn archetype:generate \
  -DarchetypeGroupId=com.github.privaliatech \
  -DarchetypeArtifactId=gingerspec-starter \
  -DgroupId=eu.vptech \
  -Dversion=1.0-SNAPSHOT \
  -DartifactId=myproject

This will create a ready-to-use project based on a template with best practices and examples that you can modify in the way you see fit for your needs

Aspects

As part of GingerSpec implementation, there are a couple of tags which may be useful for your scenarios:

βœ‰οΈ Slack integration:

Send a message to a Slack channel(s) when your scenario fails. Read more.

@slack[#mychannel]
    Scenario: A successful response with a valid body is returned
        Given I securely send requests to 'jsonplaceholder.typicode.com:443'
        When I send a 'GET' request to '/posts'
        Then the service response status must be '200'

πŸ“Š Jira integration

Update tickets in jira based onn tests results and perform conditional execution based on status of tickets. Read more.

@jira[QMS-990]
Scenario: A new element is inserted via a POST call
    Given I send requests to '${REST_SERVER_HOST}:3000'
    When I send a 'POST' request to '/posts' based on 'schemas/mytestdata.json' as 'json'
    Then the service response status must be '201'

β›” Ignore scenarios

Easily ignore scenarios using the @ignore tag. Read more.

  @ignore @toocomplex
  Scenario: Ignored scenario (too complex)
    Given I run '[ "THIS SHOULDNT HAVE BEEN RUN" = "!UNEXISTANT_VAR" ]' locally
    Given I run 'exit 1' locally

βš™οΈ Use and create variables

Use annd create variables directly in feature files. Read more.

  Scenario: A new element is inserted via a POST call
    Given I send requests to '${REST_SERVER_HOST}:3000'
    When I send a 'POST' request to '/posts' based on 'schemas/mytestdata.json' as 'json'
    Then the service response status must be '201'
    And I save element '$.title' in environment variable 'TITLE'
    Then '${TITLE}' matches 'This is a test'

πŸ”„ Conditional execution

Allow the conditional execution of scenarios based on a given environment variable. Read more.

@runOnEnv(SECS)
Scenario: Dummy scenario
     And I wait '${SECS}' seconds

@skipOnEnv(SECS_2)
Scenario: Dummy scenario
    And I wait '${SECS}' seconds

And many others more! πŸ˜‹

Steps

GingerSpec contains tons of predefined Gherkin steps ready to use in your own features. The steps cover a wide range of functionality, from steps for testing Rest endpoints, perform front-end etsting using selenium, and even for testing kafka services!

Testing Rest services

  Scenario: A successful response with a valid body is returned
    Given I securely send requests to 'jsonplaceholder.typicode.com:443'
    When I send a 'GET' request to '/posts'
    Then the service response status must be '200'
    And I save element '$.[0].userId' in environment variable 'USER_ID'
    Then '${USER_ID}' matches '1'
    
  Scenario: Add the body to be sent directly
    Given I securely send requests to 'jsonplaceholder.typicode.com:443'
    When I send a 'POST' request to '/posts' with body
        """
            {
              "userId": 1,
              "title": "This is a test",
              "body": "This is a test"
            }
          """
    Then the service response status must be '201'

Testing a web page

  @web
  Scenario: Fill the form and click the submit button
    Given I go to 'http://demoqa.com/text-box'
    And I type 'John' on the element with 'id:userName'
    And I type '[email protected]' on the element with 'id:userEmail'
    And I type '123 fake address' on the element with 'id:currentAddress'
    When I scroll down until the element with 'id:submit' is visible
    And I click on the element with 'id:submit'
    Then at least '1' elements exists with 'id:output'

Testing database

  Scenario: Executing SELECT statements on a MySQL database
    Given I connect with JDBC to database 'mysql' type 'mysql' on host '${MYSQL_HOST}' and port '3306' with user 'root' and password 'mysql'
    Then I execute query 'CREATE TABLE IF NOT EXISTS weather1 (city varchar(80), temp_lo int, temp_hi int, prcp real, date date);'
    Then I execute query 'TRUNCATE weather1'
    Then I execute query 'INSERT INTO weather1 (city, temp_lo, temp_hi, prcp, date) VALUES ('San Francisco', 15, 43, 0.0, '2004-11-29');'
    Then I execute query 'INSERT INTO weather1 (city, temp_lo, temp_hi, prcp, date) VALUES ('Kyiv', 5, 37, 0.4, '2014-11-29');'
    Then I execute query 'INSERT INTO weather1 (city, temp_lo, temp_hi, prcp, date) VALUES ('Paris', 8, 37, 0.4, '2016-11-30');'
    When I query the database with 'SELECT * FROM weather1;'
    Then I check that result is:
      | city          | temp_lo | temp_hi | prcp | date       |
      | San Francisco | 15      | 43      | 0.0  | 2004-11-29 |
      | Kyiv          | 5       | 37      | 0.4  | 2014-11-29 |
      | Paris         | 8       | 37      | 0.4  | 2016-11-30 |
    Then I check that table 'weather1' is iqual to
      | city          | temp_lo | temp_hi | prcp | date       |
      | San Francisco | 15      | 43      | 0.0  | 2004-11-29 |
      | Kyiv          | 5       | 37      | 0.4  | 2014-11-29 |
      | Paris         | 8       | 37      | 0.4  | 2016-11-30 |

And many many more!

Contributing Members to GingerSpec

QA Team Lead: Oleksandr Tarasyuk (@oleksandr.tarasyuk)

Other Members:

Name Slack Handle
Jose Fernandez Duque @josefd8