All Projects → getapid → apid

getapid / apid

Licence: GPL-3.0 license
User focused API testing

Programming Languages

go
31211 projects - #10 most used programming language
Jsonnet
166 projects

Projects that are alternatives of or similar to apid

Fluentassertions
A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit tests. Targets .NET Framework 4.7, .NET Core 2.1 and 3.0, as well as .NET Standard 2.0 and 2.1. Supports the unit test frameworks MSTest2, NUnit3, XUnit2, MSpec, and NSpec3.
Stars: ✭ 2,449 (+2621.11%)
Mutual labels:  assertions
Truss
Assertions API for Clojure/Script
Stars: ✭ 239 (+165.56%)
Mutual labels:  assertions
jsonassert
A Go test assertion library for verifying that two representations of JSON are semantically equal
Stars: ✭ 102 (+13.33%)
Mutual labels:  assertions
K9
Rust testing library
Stars: ✭ 194 (+115.56%)
Mutual labels:  assertions
Check Types.js
MOVED TO GITLAB
Stars: ✭ 232 (+157.78%)
Mutual labels:  assertions
json matcher
Library for simplifying data verification in functional tests for your JSON-based APIs
Stars: ✭ 24 (-73.33%)
Mutual labels:  assertions
Checkmate
Fast and versatile argument checks
Stars: ✭ 174 (+93.33%)
Mutual labels:  assertions
jasmine2-custom-message
custom failure message on any jasmine v2 assertion
Stars: ✭ 27 (-70%)
Mutual labels:  assertions
Jest Chain
Chain Jest matchers together to create one powerful assertion 🃏⛓
Stars: ✭ 235 (+161.11%)
Mutual labels:  assertions
zerocode-hello-world
Zerocode YAML and JSON based declarative steps hello world rest api testing example - soap, database
Stars: ✭ 18 (-80%)
Mutual labels:  assertions
Gotest.tools
A collection of packages to augment the go testing package and support common patterns.
Stars: ✭ 205 (+127.78%)
Mutual labels:  assertions
Pester
Pester is the ubiquitous test and mock framework for PowerShell.
Stars: ✭ 2,620 (+2811.11%)
Mutual labels:  assertions
tau
A Micro (1k lines of code) Unit Test Framework for C/C++
Stars: ✭ 121 (+34.44%)
Mutual labels:  assertions
Testify
A toolkit with common assertions and mocks that plays nicely with the standard library
Stars: ✭ 14,996 (+16562.22%)
Mutual labels:  assertions
kiwi
Fluent assertions for Kotlin
Stars: ✭ 17 (-81.11%)
Mutual labels:  assertions
Redux Actions Assertions
Simplify testing of redux action and async action creators
Stars: ✭ 177 (+96.67%)
Mutual labels:  assertions
superdeno
Super-agent driven library for testing Deno HTTP servers.
Stars: ✭ 119 (+32.22%)
Mutual labels:  assertions
picolisp-unit
Unit Testing framework for PicoLisp
Stars: ✭ 22 (-75.56%)
Mutual labels:  assertions
assert.sh
❗ Assertion lib for shell script users
Stars: ✭ 105 (+16.67%)
Mutual labels:  assertions
chai
BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.
Stars: ✭ 7,842 (+8613.33%)
Mutual labels:  assertions

User Focused API testing

🔭 What is APId?

APId is a framework that lets you write declarative, end-to-end collections of requests and make sure your API behaves the way you expect.

⬇️ Installation

APId comes in both binary packages and docker image. You can find the docker image here, while the binaries can be found here

Here's how to install the latest binary on UNIX based systems:

# make sure to substitute the URL with the correct platform for you
curl -L https://github.com/getapid/apid/releases/latest/download/apid-darwin-arm64 -o /tmp/apid
chmod +x /tmp/apid
sudo mv /tmp/apid /usr/local/bin/apid

# test if the installation was successful 
apid version

A simple test

APId tests, or specs, are written in jsonnet. There are a number of built-in useful functions to make it easier to make and validate requests to your API.

// contents of `example.jsonnet`

{
  simple_spec: spec([
    {
      name: "google homepage",
      request: {
        method: "GET",
        url: "https://www.google.com/"
      },
      expect: {
        code: 200
      }
    }
  ])
}

And to run the test

> apid check -s "example.jsonnet"

example::simple_spec
    google homepage
        + status code is 200

specs passed: 1
specs failed: 0

Success! You've just written your first APId test! If you change the expect.code from 200 to lets say 500 the test will fail and this will be the output:

> apid check -s "example.jsonnet"

example::simple_spec
    google homepage
        o status code: wanted 500, got 200  

specs passed: 0
specs failed: 1

For more examples please check the examples folder in this repository.

📚 Documentation

You can find the most up to date documentation here

Patterns

Jsonnet is a very powerful language which can be utilised to make your life easier.

Split variables from tests

For example you can extract any variables in a separate file

// vars.libsonnet
{
  url: 'http://localhost:8080',
}

// test.jsonnet
{
    name: 'request',
    request: {
        url: vars.url,
    },
    expect: {
        code: 200,
    },
},

Store matchers in variables

You can extract your matchers in a local variable to make the test easier to read

// test.jsonnet
local key_matcher = key(
    or([
        regex("\\w+"),
        regex("\\d+"),
    ])
);

{
    body: {
        [key_matcher]: "the value of that key" // note the [] around the key, ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#computed_property_names
    }
}

⁉️ Help

If you have any questions or ideas please feel free to head over to the discussion tab in this repository and ask away!

💻 CLI

  1. Head to the latest release and select the binary for your operating system.
  2. Once downloaded open the archive and place the executable in a directory on your $PATH.

👽 Contributing

To contribute to APId, please see CONTRIBUTING.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].