A BDD library for Go

Overview

gospecify

This provides a BDD syntax for testing your Go code. It should be familiar to anybody who has used libraries such as rspec.

Installation

The Makefile assumes that you have the environment variables that are typically set for using the Go language (GOROOT, GOARCH, GOOS, and optionally GOBIN). Please refer to the GO installation instructions (http://golang.org/doc/install.html) for more information on properly setting them.

Once those variables are set you can:

 $ make test
 $ make install              # This will install the specify script in $HOME/bin
 $ make install GOBIN=$GOBIN # This will install the specify script in $GOBIN

Usage

Take a look at src/example_spec.go for a simple example of how to write specifications using gospecify. Just put the code in package main and import your own code in. You can then use the specify command to compile and run your specs.

 $ specify *_spec.go

Or if you need to specify a package path you can do this:

 $ specify -I/path/to/pkg *_spec.go

You can look at src/Makefile to see how gospecify runs the command to test itself.

Contributing

Contributions are always welcome. Just clone the git repo and hack away. You can submit pull requests or email me patches.

Happy Testing!

You might also like...
Terratest is a Go library that makes it easier to write automated tests for your infrastructure code.

Terratest is a Go library that makes it easier to write automated tests for your infrastructure code. It provides a variety of helper functions and patterns for common infrastructure testing tasks,

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

gostub is a library to make stubbing in unit tests easy

gostub gostub is a library to make stubbing in unit tests easy. Getting started Import the following package: github.com/prashantv/gostub Click here t

A library for generating fake data such as names, addresses, and phone numbers.

faker Faker is a library for generating fake data such as names, addresses, and phone numbers. It is a (mostly) API-compatible port of Ruby Faker gem

A WebDriver client and acceptance testing library for Go
A WebDriver client and acceptance testing library for Go

Agouti Agouti is a library for writing browser-based acceptance tests in Google Go. It provides Gomega matchers and plays nicely with Ginkgo or Spec.

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.

WebDriverAgent ( iOS ) Client Library in Golang

appium/WebDriverAgent Client Library in Golang

A library to aid unittesting code that uses Golang's Github SDK

go-github-mock A library to aid unittesting code that uses Golang's Github SDK Installation go get github.com/migueleliasweb/go-github-mock Features C

gomonkey is a library to make monkey patching in unit tests easy

gomonkey is a library to make monkey patching in unit tests easy, and the core idea of monkey patching comes from Bouke, you can read this blogpost for an explanation on how it works.

Comments
  • Changes for make test and make install to work on a clean system

    Changes for make test and make install to work on a clean system

    Hi Samuel, here are a few changes I made that helped with the test and install process on my machine. It seems like "make test" was dependent on specify having been previously installed. These changes allow "make test" to run without installing.

    opened by alexdioso 0
  • Build failed!!!

    Build failed!!!

    [email protected]:~/repos/golang/gospecify$ make
    cd src; make test
    make[1]: enter directory `/home/michael/repos/golang/gospecify/src'
    Makefile:21: /home/michael/opt/go/src/Make.inc: file or directory not exists.
    Makefile:40: /home/michael/opt/go/src/Make.pkg: file or directory not exists.
    make[1]: *** there is no rules to create“/home/michael/opt/go/src/Make.pkg”。 stop。
    make[1]:leave directory `/home/michael/repos/golang/gospecify/src'
    make: *** [test] error 2
    

    /src/Make.inc /src/Make.pkg Those two file do not exists.

    opened by hfeeki 4
Owner
Samuel Tesla
Samuel Tesla
Gherkin-based BDD testing for go

gocuke ?? gocuke is a Gherkin-based BDD testing library for golang. Features tight integration with *testing.T (use any standard assertion library or

Regen Network 6 Jun 22, 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 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

Fortio (Φορτίο) 2.7k Sep 21, 2022
:exclamation:Basic Assertion Library used along side native go testing, with building blocks for custom assertions

Package assert Package assert is a Basic Assertion library used along side native go testing Installation Use go get. go get github.com/go-playground/

Go Playgound 46 Sep 14, 2022
Library created for testing JSON against patterns.

Gomatch Library created for testing JSON against patterns. The goal was to be able to validate JSON focusing only on parts essential in given test cas

null 43 Sep 27, 2022
A Go test assertion library for verifying that two representations of JSON are semantically equal

jsonassert is a Go test assertion library for verifying that two representations of JSON are semantically equal. Usage Create a new *jsonassert.Assert

Roger Guldbrandsen 93 Sep 21, 2022
A Go library help testing your RESTful API application

RESTit A Go micro-framework to help writing RESTful API integration test Package RESTit provides helps to those who want to write an integration test

RESTit 56 Sep 27, 2022
testcase is an opinionated behavior-driven-testing library

Table of Contents testcase Guide Official API Documentation Getting Started / Example Modules Summary DRY Modularization Stability Case Study About te

Adam Luzsi 100 Sep 27, 2022
A toolkit with common assertions and mocks that plays nicely with the standard library

Testify - Thou Shalt Write Tests ℹ️ We are working on testify v2 and would love to hear what you'd like to see in it, have your say here: https://cutt

Stretchr, Inc. 17.7k Sep 25, 2022
Playwright for Go a browser automation library to control Chromium, Firefox and WebKit with a single API.

?? Playwright for API reference | Example recipes Playwright is a Go library to automate Chromium, Firefox and WebKit with a single API. Playwright is

Max Schmitt 936 Sep 26, 2022
ESME is a go library that allows you to mock a RESTful service by defining the configuration in json format

ESME is a go library that allows you to mock a RESTful service by defining the configuration in json format. This service can then simply be consumed by any client to get the expected response.

Sumit Tokkar 3 Mar 2, 2021