Categorygithub.com/carloshjoaquim/E2Easy-Go
repository
1.5.1
Repository: https://github.com/carloshjoaquim/e2easy-go.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

E2Easy-Go

E2Easy-Go is a library to create a complex end-to-end tests and validations writing a simple yaml file. It's possible to define a set of information based on pre-defined configuration to start a flow of REST API calls, and use the result for validations or next flows call.

The library runs on the console where it is possible to pass an input file (.yaml) to be consumed, this file defines the steps and validations of the end-to-end test.

How to execute:

execution

Allowed properties


PropertyInformationExample
nameSet the E2E flow namename: my_e2e_test
stepsArray of steps for E2E Teststeps:
- name: ....
nameName of a single E2E Test stepsteps:
- name: get_validation
pathURL path for call APIsteps:
- ...
path: http://my-endpoint/valid
methodREST Method to call API for this stepsteps:
- ...
method: GET
bodystring with json BODY to cal API if necessarysteps:
- ...
body: "{ "reference_id": "TST-E2E004"}"
headersheader information if necessary (name and value)steps:
- ...
headers:
- name: "Authorization
value: Z8LM1y7LMTgbUFgJ4maMKGTdsIR8Nb
varsConfiguration to save a value to a variable to use in E2E Test

To get a value of a response, you can navigate with response node
like: response.body.PROPERTY
steps:
- ...
vars:
- id: response.body.my_response_property
testsSet of tests validations to perform for step.

You can set how many tests you want, allowed tests type is:
- equals: to compare is expected is exactly equals actual value.
- contains: to verify if actual value contains expected value.
- not_nil: to verify if actual value is no null (nil in go).
- nil: to verify if actual value is null (nil in go).
tests:
- name: same_reference
expected: "TST-E2E-GO"
actual: ${id}
type: equals

Example 1:

To create a simple GET call to an URL and validate the result:
name: contract_retention
steps:
  - name: contrato
    path: https://mail-generator.herokuapp.com/generate?domain=hotmail
    method: GET
    vars:
      fullBody: response.body
      email: response.body.mail
      statusCode: response.statusCode
    tests:
      - name: return_hotmal
        expected: "hotmail"
        actual: ${email}
        type: contains
      - name: status_ok
        expected: 200
        actual: ${statusCode}
        type: equals
``