Giter VIP home page Giter VIP logo

abhimanyu003 / probe Goto Github PK

View Code? Open in Web Editor NEW
31.0 3.0 1.0 5.07 MB

Simplified Integration Testing Using YAML and JQ

Home Page: https://abhimanyu003.github.io/probe/

License: MIT License

Go 87.65% Shell 12.35%
api-testing integration-testing rest-api-test testing assertions cli test-framework end-to-end-testing e2e-testing go golang test-automation contract-testing developer-tools devutils http testing-tools

probe's Introduction

Probe

Simplified End-to-End Testing Using YAML and JQ.

Full documentation is available on the official website: https://abhimanyu003.github.io/probe/

All Features

  • Cross-platform: Runs on windows, mac and linux.
  • JQ: Full in-built JQ support ( no need to install JQ ).
  • Parallel: Fast parallel testing for multiple tests
  • Multi-Stages: Call multiple systems and services in single test.
  • Variables: Supports env and user defined variables.
  • Setup and Teardown: Run things beforeEach, afterEach, beforeAll, afterAll, stages.
  • Logs: powerful logs that, dump the complete request and response content.
  • Request Builder: Easy request builder that allows you to set:
    • Allow Insecure
    • Basic Auth
    • Bearer Auth Token
    • Body
    • Form Data
    • Headers
    • Json
    • Query Param
    • Sleep
    • Timeout
    • User-Agent
    • Upload

Documentation

Documentation is available at https://abhimanyu003.github.io/probe/

Tutorials and examples

๐Ÿ”‹ Install Probe

Probe support wide variety of OS

  • linux, darwin, windows
  • 386, amd64, arm64

Auto Install

curl -L https://raw.githubusercontent.com/abhimanyu003/probe/main/install.sh | bash

This script installs the latest release by default.

Brew

brew install abhimanyu003/tap/probe

Scoop

scoop bucket add probe https://github.com/abhimanyu003/scoop-bucket.git
scoop install probe

Arch Linux

yay -S probe-bin

Snap

At this point we have to alias while using snap

sudo snap install go-probe
sudo snap alias go-probe.probe probe

Go Install

go install github.com/abhimanyu003/probe@latest

Wget

Use wget to download, gzipped pre-compiled binaries.

For instance, VERSION=v0.0.1 and BINARY=probe_0.0.1_linux_amd64

wget https://github.com/abhimanyu003/probe/releases/download/${VERSION}/${BINARY}.tar.gz -O - |\
  tar xz && mv probe /usr/bin/probe

You can find list of binary and release over Release Page!

Manually

Download the pre-compiled binaries from the Release! page and copy them to the desired location.

You can download

  • DEB
  • RPM
  • Pre-compiled binary

Visit Release!

๐Ÿ’ฅ Usages

Full documentation is available on the official website: https://abhimanyu003.github.io/probe/

Quick Example

  • Create main.yaml file
name: Writing Test
stages:
  - name: first stage
    request:
      url: "https://httpbin.org/get"
      method: GET
    assert:
      status: 200
  • Run
probe run main.yaml

Examples

Here are some quick example that shows how you can use probe with YAML + JQ. This will help you get some quick idea on how you can write your API tests

JQ Example

name: JQ Example
stages:
  - name: get products request
    request:
      url: "https://dummyjson.com/products"
      method: GET
    assert:
      status: 200
      body:
        - select: .products | length
          want: 50

        - select: .products[0].id | isnormal
          want: true

        - select: .products[0].images | length
          want: 5

        - select: .products[] | select(.title == "iPhone 9") | .id
          want: 1

Form Data

name: Form Data
stages:
  - name: add product
    request:
      url: "https://dummyjson.com/products/add"
      method: POST
      headers:
        Content-Type: 'application/json'
      formData:
        title: 'BMW Pencil'
    assert:
      status: 200
      body:
        - select: .id
          want: 101

Contribution

This project welcomes your PR and issues. For example, refactoring, adding features, correcting English, etc.

A quick development guide can be found on. Developer-Guides wiki page.

If you need any help, you can contact me on Twitter.

Thanks to all the people who already contributed and libraries imported in go.mod

License

MIT

probe's People

Contributors

abhimanyu003 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ethanholz

probe's Issues

bug: does not properly validate assertion of status code

Hello! When using probe to validate status codes, it will pass regardless of what the status code is set to. An example of this is running the following test case:

name: Writing Test
stages:
  - name: first stage
    request:
      url: "https://google.com"
      method: GET
    assert:
      status: 200

This test case should fail with a status code of 301 but instead you will receive a pass.

how to use negate assertion (not equal / is not empty)

Hi, i try to write test auth with assertion the token is not empty ( not equal = '').
I can't use the want key, do you know how to accomplish it?

this sample from documentation

name: auth and get user
stages:
  - name: auth
    request:
      url: "https://dummyjson.com/auth/login"
      method: POST
      formData:
        username: kminchelle
        password: 0lelplR
    assert:
      status: 200
    export:
      body:
        - select: .id
          as: userId # setting id as userId variable
        - select: .token
          as: token # setting token id as variable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.