Skip to content
forked from tomatool/tomato

behavioral testing tools - keep your application healthy with πŸ…

License

Notifications You must be signed in to change notification settings

nasyaoris/tomato

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ… 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
      params:
        datasource: {{ .PSQL_DATASOURCE }}

    - name: your-application-client
      type: httpclient
      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/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

About

behavioral testing tools - keep your application healthy with πŸ…

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.0%
  • Makefile 2.3%
  • Other 0.7%