Skip to content
No description, website, or topics provided.
Java Gherkin Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
jenkins_home
src
.gitignore
Jenkinsfile
ParalellJenkinsFile
README.md
SecuencialJenkinsFile
Vagrantfile
advanceFilter.png
docker-compose.yml
extent-config.xml
pom.xml
testng.xml
testngParalell.xml

README.md

LIPPIA API Example Project

System Requirements :

Docker stack

The following project includes the basic Docker Lippia Containers to run this web sample project. You can choose to run the code from your favourite IDE, run from console or from Jenkins using the Docker Stack. To install and start a local instalation with Docker containers go to Getting started at the end of this guide.

Purpose:

The following project has the purpose of demonstrate and let test automation developers to to test API requests using Lippia Automation Framework based on Rest Client library. This sample project includes the required components as binaries, docker containers and configuration files to simply download and run a set of sample tests in your local computer, using the Lippia container stack described bellow.

Getting started

Executing tests in you local machine

  • go to root project folder and you will find a pom.xml file
  • run the following command :
mvn clean test

Project structure

A typical Lippia Test Automation project usually looks like this

	.
├── main
│   ├── java
│   │   └── com
│   │       └── crowdar
│   │           └── api
│	│				├── config
│	│				│	├── EntityConfiguration.java
│   │               ├── model
│   │               │   ├── Data.java
│	│				│	├── User.java
│   │               │   └── UserCreated.java
│   │               └── services
│   │                   └── UserService.java
│   └── resources
│       ├── config.properties
│       ├── cucumber.properties
│       └── log4j.properties
└── test
    ├── java
    │   ├── ApiExampleProjectParallelTestRunner.java
    │   ├── ApiExampleProjectTestRunner.java
    │   └──
	└── steps	
	│   └── UserSteps.java
	└── apiExampleProject
    │           ├── Hooks.java
    └── resources
        └── features
            └── ApiExample.feature
		└── jsons
            └── createUser.json

Folder's description:

Path Description
main\java\...\examples\model\*.java Folder with all the Mapped Objects matching steps with java code
main\java\...\examples\config\*Steps.java Folder with all the Settings wich match with Gherkin Test Scenarios
test\resources\features\*.feature Folder with all the feature files containing Test Scenarios and Sample Data
main\resources Folder with all configuration needed to run Lippia

In this example, ApiExample is the first endpoint the framework will interact with. The steps defined in UserSteps.java to execute the Test Scenarios defined in Gherkin language.

File Description
User.java Model: you can declare every attribute expected on the responses that you want to interact with. You need to add one new file for each response you want to model in your tests.
UserSteps.java StepOpject: Code to support the behaviour of each step coded into the feature files for the User endpoint. This code executes the interaction between the Framework and the api endopoint and match the steps with the code who run interactions.
ApiExample.feature Feature file: Definition of the Test Scenarios with all the steps written in Cucumber format (http)

Model Object Example

In the model examples you can mapped the expected objects from different api responses. We can show you a little example:

{
    "data": {
        "id": 2,
        "email": "janet.weaver@reqres.in",
        "first_name": "Janet",
        "last_name": "Weaver",
        "avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg"
    }
}

So the model class will be something like this:

   public class User {

    @JsonProperty("id")
    private int id;
    @JsonProperty("email")
    private String email;
    @JsonProperty("first_name")
    private String first_name;
    @JsonProperty("last_name")
    private String last_name;
    @JsonProperty("avatar")
    private String avatar;

    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getFirst_name() {
        return first_name;
    }
    public void setFirst_name(String first_name) {
        this.first_name = first_name;
    }
    public String getLast_name() {
        return last_name;
    }
    public void setLast_name(String last_name) {
        this.last_name = last_name;
    }
    public String getAvatar() {
        return avatar;
    }
    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }
	}

The idea is have one attribute per field to map on the response

Lippia Architecture

Lippia Architecture API

Scenario Example

Lippia Scenarios Example API

The scenarios can be written using BDD methodology.

Given as a precondition

When as actions

Then as validations

On each declared step you can insert the calls defined from service classes

Json Structure for request data

This project use json to manage request data like url parameters, body data, headers and url endpoints. The following picture shows the structure of the json

Lippia Scenarios Example API

Extent Report

This project like all lippia products uses Extent reports that shows the status of each test run. This report also describe stadistic data for the total number of tests and the status of those

Lippia Scenarios Example API

Requirements :

Getting started

You can’t perform that action at this time.