modulepackage
0.0.0-20161224202746-3e71f58e2cc3
Repository: https://github.com/101loops/bdd.git
Documentation: pkg.go.dev
# README
bdd

Go package for writing BDD-style tests.
Example
package bdd
import . "github.com/101loops/bdd"
var _ = Describe("User Service", func() {
It("loads users by domain name", func() {
users, err := service.loadUsersByDomain("acme.com")
Check(err, IsNil)
Check(users, HasLen, 2)
Check(users[0].IsActive, IsTrue)
Check(users[0].FirstName, Equals, "Roger")
Check(users[0].Bio, Contains, "ACME").And("Roger").ButNot("fired")
})
})
Install
go get github.com/stephanos/bdd`
Documentation
http://godoc.org/github.com/stephanos/bdd
Credit
Uses Ginkgo and Gomga internally (both MIT).
License
MIT (see LICENSE).
# Functions
AfterEach blocks are run after It blocks.
AfterSuite blocks are *always* run after all the specs regardless of whether specs have passed or failed.
Assert wraps an actual value allowing assertions to be made on it: Assert("foo", Equals, "foo").
BeforeEach blocks are run before It blocks.
BeforeSuite blocks are run just once before any specs are run.
Check wraps an actual value allowing assertions to be made on it: Check("foo", Equals, "foo").
CheckFail will record a failure for the current space and panic.
Context blocks allow you to organize your specs.
Describe blocks allow you to organize your specs.
Expect wraps an actual value allowing assertions to be made on it: Expect("foo", Equals, "foo").
It blocks allow you to organize your specs.
No description provided by the author
Not negates a matcher.
RunSpecs is the entry point for the test runner.
Scenario blocks are an alias for With blocks.
Should blocks are an alias for It blocks.
To blocks are an alias for It blocks.
When blocks are an alias for With blocks.
With blocks are an alias for With blocks.
Ω wraps an actual value allowing assertions to be made on it: Ω("foo", Equals, "foo").
# Variables
Contains succeeds if actual contains all passed in substrings / elements.
Equal uses reflect.DeepEqual to compare actual with expected.
EqualsNum succeeds if actual has the same numeric value as the passed-in number.
ErrorContains succeeds if actual is a non-nil error and contains the passed-in substring.
HasElem succeeds if actual contains the passed in element.
HasElems succeeds if actual contains all passed in element.
HasKey succeeds if actual is a map with the passed-in key.
HasKeys succeeds if actual is a map with all passed-in keys.
HasLen succeeds if actual has the passed-in length.
HasOccurred succeeds if actual is a non-nil error.
Regexp succeeds if actual is a string or stringer that matches the has the passed-in prefix.
HasSubstr succeeds if actual is a string or stringer that contains the passed-in substring.
Regexp succeeds if actual is a string or stringer that matches the has the passed-in suffix.
IsAfter succeeds if actual is later than the passed-in time.
IsAssignableTo succeeds if actual is assignable to the type of expected.
IsBefore succeeds if actual is earlier than the passed-in time.
IsClosed succeeds if actual is a closed channel.
IsEmpty succeeds if actual is empty.
IsEquivalentTo is more lax than Equal, allowing equality between different types.
IsFalse succeeds if actual is false.
IsGreaterThan succeeds if actual is a greater than the passed-in number.
IsGreaterThanOrEqTo succeeds if actual is a greater than or equal to the passed-in number.
IsLessThan succeeds if actual is a smaller than the passed-in number.
IsLessThanOrEqTo succeeds if actual is a smaller than or equal to the passed-in number.
IsNil succeeds if actual is nil.
IsOnOrAfter succeeds if actual is the same time or later than the passed-in time.
IsOnOrBefore succeeds if actual is the same time or earlier than the passed-in time.
IsRoughly succeeds if actual has about the same numeric value as the passed-in number.
IsSameTimeAs succeeds if actual is the same time or later than the passed-in time.
IsTrue succeeds if actual is true.
IsZero succeeds if actual is the zero value for its type or if actual is nil.
Regexp succeeds if actual is a string or stringer that matches the passed-in regexp.
NotNil succeeds if actual is not nil.
Panics succeeds if actual is a function that, when invoked, panics.
# Structs
Checker makes assertions based on values and matchers.
No description provided by the author
Result is the result from applying a Matcher.
# Interfaces
Matcher can check if a passed-in value matches the matcher's expectations.
MatcherArgsLimiter can limit the amount of arguments for a matcher.
MatcherArgsRequierer can require a certain amount of arguments for a matcher.