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.
- 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
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
params:
datasource: {{ .PSQL_DATASOURCE }}
- name: your-application-client
type: httpclient
params:
base_url: {{ .APP_BASE_URL }}
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
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
curl https://raw.githubusercontent.com/tomatool/tomato/master/install.sh | sh
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
Now run tomato:
tomato tomato.yml
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.
- Database SQL - to manage (insert/check) database state changes
- HTTP Client - to send HTTP Request
- HTTP Server - to mock external HTTP Server
- Message Queue - to manage (publish/consume/check) message queue
- Shell - to execute unix shell command-line interface
- Cache