tomato

module
v0.0.0-...-9a3fa0c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2018 License: Apache-2.0

README

🍅 tomato - behavioral testing tool kit

CircleCI Go Report Card GoDoc codecov.io

Tomato is a language agnostic testing tool kit that simplifies the acceptance testing workflow of your application and its dependencies.

Using godog and Gherkin, tomato makes behavioral tests easier to understand, maintain, and write for developers, QA, and product owners.

Features

  • Cucumber Gherkin feature syntax
  • Support for MySQL, MariaDB, and PostgreSQL
  • Support for messaging queues (RabbitMQ, NSQ)
  • Support for mocking HTTP API responses
  • Additional resources resources

Getting Started

Set up your tomato configuration

Tomato integrates your app and its test dependencies using a simple configuration file tomato.yml.

Create a tomato.yml file with your application's required test resources:

---

resources:
    - name: psql
      type: database/sql
      params:
        driver: postgres
        datasource: {{ .PSQL_DATASOURCE }}

    - name: your-application-client
      type: http/client
      params:
        base_url: {{ .APP_BASE_URL }}
Write your first feature test

Write your own Gherkin feature (or customize the check-status.feature example below) and place it inside ./features/check-status.feature:

Feature: Check my application's status endpoint

  Scenario: My application is running and active
    Given "your-application-client" send request to "GET /status"
    Then "your-application-client" response code should be 200
Run tomato
Using docker-compose

Now that you have your resources configured, you can use docker-compose to run tomato in any Docker environment (great for CI and other build pipelines).

Create a docker-compose.yml file, or add tomato and your test dependencies to an existing one:

version: '3'
services:
  tomato:
    image: quay.io/alileza/tomato:latest
    environment:
      APP_BASE_URL: http://my-application:9000
      PSQL_DATASOURCE: "postgres://user:password@postgres:5432/test-database?sslmode=disable"
    volumes:
      - ./tomato.yml:/config.yml # location of your tomato.yml
      - ./features/:/features/   # location of all of your features

  my-application:
    build: .
    expose:
      - "9000"

  postgres:
    image: postgres:9.5
    expose:
      - "5432"
    environment:
            POSTGRES_USER: user
            POSTGRES_PASSWORD: password
            POSTGRES_DB: test-database
    volumes:
      - ./sqldump/:/docker-entrypoint-initdb.d/ # schema or migrations sql

Execute your tests

docker-compose up --abort-on-container-exit
Using the binary

Install tomato by grabbing the latest stable release and placing it in your path, or by using go get

go get -u github.com/alileza/tomato/cmd/tomato

Now run tomato:

tomato -c tomato.yml -f check-status.feature

Resources

Resource are the objects that are going to be used for steps in the scenario. They are listed under the resources key in the pipeline configuration.

List of available resources

Directories

Path Synopsis
cmd
generate
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
util

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL