tomato

command module
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: Apache-2.0 Imports: 9 Imported by: 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:

---

# Randomize scenario execution order
randomize: true

# Stops on the first failure
stop_on_failure: false

# All feature file paths
features_path:
    - ./features
    - check-status.feature

# List of resources for application dependencies
resources:
    - name: psql
      type: postgres
      options:
        datasource: {{ .PSQL_DATASOURCE }}

    - name: your-application-client
      type: httpclient
      options:
        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/tomatool/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
Install latest stable version
curl https://raw.githubusercontent.com/tomatool/tomato/master/install.sh | sh
Install latest master

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

go get -u github.com/tomatool/tomato
Executing tomato

Now run tomato:

tomato tomato.yml

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

Documentation

The Go Gopher

There is no documentation for this package.

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
cache
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
database/sql
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
http/client
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
http/server
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
queue
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
queue/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
shell
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
GENERATED FILE - DO NOT EDIT Rebuild from the tomatool generate handler tool
nsq

Jump to

Keyboard shortcuts

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