Ditto is a CLI testing tool that helps you verify if multiple HTTP endpoints have the same outputs.

Ditto

Go Report Card

Ditto is a CLI testing tool that helps you verify if multiple HTTP endpoints have the same outputs.

One of the use case of Ditto is regression testing between two or more HTTP endpoints.

Features

  1. Works with normal HTTP REST API and GraphQL endpoints with various stringifiable response bodies.
  2. Parallel test execution.
  3. Configurability.

Installation

Make sure that you have Go installed in your machine.

Ditto comes with two separate binaries, ditto and ditto-gen. ditto is the core of Ditto that executes your tests while ditto-gen is a utility tool that helps you write tests for ditto.

You can install Ditto by executing the following command in your terminal.

go install github.com/Namchee/ditto/cmd/ditto

To install ditto-gen instead, you can execute the following command.

go install github.com/Namchee/ditto/cmd/ditto-gen

Test Structure

When Ditto is being executed, Ditto will try to search for test definitions that should be stored in the test directory folder.

A test is defined as a JSON file with the following format.

Key Type Description
name string Test name. Used when reporting test run results.
endpoints []Endpoints List of endpoints that should be tested. There must be at least two endpoints for a valid test definition.

An endpoint is defined as an object with the following format.

Key Type Description
host string Host name. Must be an IP or an URL.
method string Case-sensitive HTTP method. Must be either GET, POST, PUT, PATCH, or DELETE
query object Query object to be sent when sending HTTP request.
body object Request body to be sent when sending HTTP request.
headers object Request headers to be sent when sending HTTP request.
timeout integer Endpoint timeout in seconds. A test will automatically fail if an endpoint timeouts.

Please refer to ditto-test directory for test samples.

Usage

ditto

The ditto command is a command that runs predefined tests in the current working directory. This command does not accept any extra inputs.

ditto-gen

The ditto-gen command is a utility command that helps you create your test definitions. ditto-gen can be executed from your terminal with the following command.

ditto-gen <file_name> <test_name>

ditto-gen accepts the following arguments:

Name Type Description
filename string Test file name. Should be suffixed with .json.
testname string Test name. Used on reporting and test execution logs.

Configuration

When Ditto is executed, Ditto will try to look for ditto.config.json at the current working directory. If the corresponding file is found, Ditto will use the file as a configuration file that modifies the behavior of Ditto.

Below are the list of possible configuration for Ditto.

Name Type Default Description
test_directory string ditto-test Test directory which stores all test definitions that are going to be executed by Ditto.
log_directory string ditto-log Test execution log directory which stores all test logs when one or more tests are failing.
strict boolean false Determine if Ditto should stop test execution when one or more test definitions are invalid.
workers integer Determine the maximum number of tests that should be executed in parallel.
status boolean false Determine if passing tests should also require the same HTTP response status.

Test Logs

When a test fails, Ditto will attempt to log the test execution result in a folder with the same name as log_directory in JSON format. A test log will be named with the test name corresponding to the test data.

Test logs is an object with the following properties.

Name Type Default Description
name string ditto-test Test name.
err string ditto-log Test errors when calling the endpoint.
result []Endpoint Fetch result.

License

This project is licensed under the MIT License

Owner
Cristopher
Software Engineer | Loves Open Source and Community Movement | Inactive? Probably machine broke or RL stuff
Cristopher
Similar Resources

Tesuto - a little library for testing against HTTP services

tesuto import "github.com/guregu/tesuto" tesuto is a little library for testing

Jan 18, 2022

A Go implementation of Servirtium, a library that helps test interactions with APIs.

Servirtium is a server that serves as a man-in-the-middle: it processes incoming requests, forwards them to a destination API and writes the response into a Markdown file with a special format that is common across all of the implementations of the library.

Jun 16, 2022

Fortio load testing library, command line tool, advanced echo server and web UI in go (golang). Allows to specify a set query-per-second load and record latency histograms and other useful stats.

Fortio load testing library, command line tool, advanced echo server and web UI in go (golang). Allows to specify a set query-per-second load and record latency histograms and other useful stats.

Fortio Fortio (Φορτίο) started as, and is, Istio's load testing tool and now graduated to be its own project. Fortio is also used by, among others, Me

Jan 2, 2023

A next-generation testing tool. Orion provides a powerful DSL to write and automate your acceptance tests

Orion is born to change the way we implement our acceptance tests. It takes advantage of HCL from Hashicorp t o provide a simple DSL to write the acceptance tests.

Aug 31, 2022

Stress testing and benchmarking tool for the NEAR EVM

evm-bully --- stress testing and benchmarking tool for the NEAR EVM

May 30, 2022

Coverage testing tool for The Go Programming Language

gocov Coverage reporting tool for The Go Programming Language Installation go get github.com/axw/gocov/gocov Usage There are currently four gocov comm

Jan 3, 2023

Ddosify - High-performance load testing tool

 Ddosify - High-performance load testing tool

Ddosify - High-performance load testing tool Features ✔️ Protocol Agnostic - Currently supporting HTTP, HTTPS, HTTP/2. Other protocols are on the way.

Jan 5, 2023

Merge Mock - testing tool for the Ethereum Merge

MergeMock Experimental debug tooling, mocking the execution engine and consensus node for testing. work in progress Quick Start To get started, build

Oct 21, 2022

Hive-fleet: a distributed, scalable load-testing tool built in go that leverages Google Cloud Functions

hive-fleet hive-fleet is a distributed, scalable load-testing tool, built on top

Jan 27, 2022
Comments
  • feat: write result as json

    feat: write result as json

    Overview

    Closes #3

    This pull request adds parse option to the runner that allows the logger to write the response result as pure JSON. Do note that if the response is not parseable as JSON, it will be written as a string instead.

  • feat: result as string

    feat: result as string

    Overview

    Currently, all responses in the difference log are stored as a string. Checking the response in the intended form (JSON) brings a better user experience, especially if the response is short enough.

    As we might not know the intended format, this option should be turned off by default and users can opt-in by toggling a configuration key.

  • feat: add diff to log

    feat: add diff to log

    Overview

    Currently, it's hard to distinguish the difference between 2 endpoints if the result is different. Adding a string difference at the end result helps users to identify the difference faster.

  • docs: add disclaimer about graphql testing

    docs: add disclaimer about graphql testing

    Overview

    This pull request adds disclaimer about GraphQL API testing, which will always fail if the query names are different.

    To address this issue, user can use GraphQL alias.

siusiu (suite-suite harmonics) a suite used to manage the suite, designed to free penetration testing engineers from learning and using various security tools, reducing the time and effort spent by penetration testing engineers on installing tools, remembering how to use tools.
siusiu (suite-suite harmonics) a suite used to manage the suite, designed to free penetration testing engineers from learning and using various security tools, reducing the time and effort spent by penetration testing engineers on installing tools, remembering how to use tools.

siusiu (suite-suite harmonics) a suite used to manage the suite, designed to free penetration testing engineers from learning and using various security tools, reducing the time and effort spent by penetration testing engineers on installing tools, remembering how to use tools.

Dec 12, 2022
A yaml data-driven testing format together with golang testing library

Specimen Yaml-based data-driven testing Specimen is a yaml data format for data-driven testing. This enforces separation between feature being tested

Nov 24, 2022
HTTP load testing tool and library. It's over 9000!
HTTP load testing tool and library. It's over 9000!

Vegeta Vegeta is a versatile HTTP load testing tool built out of a need to drill HTTP services with a constant request rate. It can be used both as a

Jan 7, 2023
Client tool for testing HTTP server timeouts

HTTP timeout test client While testing Go HTTP server timeouts I wrote this little tool to help me test. It allows for slowing down header write and b

Sep 21, 2022
CLI tool to mock TCP connections. You can use it with Detox, Cypress or any other framework to automatically mock your backend or database.

Falso It is a CLI that allows you to mock requests/responses between you and any server without any configuration or previous knowledge about how it w

Sep 23, 2022
Expressive end-to-end HTTP API testing made easy in Go

baloo Expressive and versatile end-to-end HTTP API testing made easy in Go (golang), built on top of gentleman HTTP client toolkit. Take a look to the

Dec 13, 2022
Golang HTTP client testing framework

flute Golang HTTP client testing framework Presentation https://speakerdeck.com/szksh/flute-golang-http-client-testing-framework Overview flute is the

Sep 27, 2022
Extremely flexible golang deep comparison, extends the go testing package and tests HTTP APIs
Extremely flexible golang deep comparison, extends the go testing package and tests HTTP APIs

go-testdeep Extremely flexible golang deep comparison, extends the go testing package. Latest news Synopsis Description Installation Functions Availab

Dec 22, 2022
End-to-end HTTP and REST API testing for Go.

httpexpect Concise, declarative, and easy to use end-to-end HTTP and REST API testing for Go (golang). Basically, httpexpect is a set of chainable bui

Jan 5, 2023
HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽

gock Versatile HTTP mocking made easy in Go that works with any net/http based stdlib implementation. Heavily inspired by nock. There is also its Pyth

Jan 4, 2023