Description
Biff stands for BIFurcation Framework based on nesting cases or alternatives. You can take advantage of variable scoping to make your tests simpler and easier to read. Good choice for acceptance and use cases testing, it provides a BBD style exit.
biff alternatives and similar packages
Based on the "Testing Frameworks" category.
Alternatively, view biff alternatives based on common mentions on social networks and blogs.
-
Testify
A toolkit with common assertions and mocks that plays nicely with the standard library -
GoConvey
Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go. -
gnomock
Test your code without writing mocks with ephemeral Docker containers ๐ฆ Setup popular services with just a couple lines of code โฑ๏ธ No bash, no yaml, only code ๐ป -
go-vcr
Record and replay your HTTP interactions for fast, deterministic and accurate tests -
testfixtures
Ruby on Rails like test fixtures for Go. Write tests against a real database -
embedded-postgres
Run a real Postgres database locally on Linux, OSX or Windows as part of another Go application or test -
gotest.tools
A collection of packages to augment the go testing package and support common patterns. -
testza
Full-featured test framework for Go! Assertions, fuzzing, input testing, output capturing, and much more! ๐ -
go-testdeep
Extremely flexible golang deep comparison, extends the go testing package, tests HTTP APIs and provides tests suite -
dbcleaner
Clean database for testing, inspired by database_cleaner for Ruby -
GoSpec
Testing framework for Go. Allows writing self-documenting tests/specifications, and executes them concurrently and safely isolated. [UNMAINTAINED] -
jsonassert
A Go test assertion library for verifying that two representations of JSON are semantically equal -
testcase
testcase is an opinionated testing framework to support test driven design. -
assert
:exclamation:Basic Assertion Library used along side native go testing, with building blocks for custom assertions -
gogiven
gogiven - BDD testing framework for go that generates readable output directly from source code
Collect and Analyze Billions of Data Points in Real Time
Do you think we are missing an alternative of biff or a related project?
Popular Comparisons
README
Biff stands for BIFurcation Framework based on nesting cases or alternatives. You can take advantage of variable scoping to make your tests simpler and easier to read. Good choice for acceptance and use cases testing, it provides a BBD style exit.
<!-- MarkdownTOC autolink=true bracket=round -->
- Getting started
- Get into the buggy line
- Isolated use cases
- BDD on the fly
- Take advantage of go function scope
- Supported assertions
- Contribute
- Testing
- Example project
<!-- /MarkdownTOC -->
Getting started
biff.Alternative("Instance service", func(a *biff.A) {
s := NewMyService()
a.Alternative("Register user", func(a *biff.A) {
john := s.RegisterUser("[email protected]", "john-123")
a.AssertNotNil(john)
a.Alternative("Bad credentials", func(a *biff.A) {
user := s.Login(john.Email, "bad-password")
a.AssertNil(user)
}).Alternative("Login", func(a *biff.A) {
user := s.Login(john.Email, john.Password)
a.AssertEqual(user, john)
})
})
})
Output:
=== RUN TestExample
Case: Instance service
Case: Register user
john is &example.User{Email:"[email protected]", Password:"john-123"}
Case: Bad credentials
user is <nil>
-------------------------------
Case: Instance service
Case: Register user
john is &example.User{Email:"[email protected]", Password:"john-123"}
Case: Login
user is &example.User{Email:"[email protected]", Password:"john-123"}
-------------------------------
Case: Instance service
Case: Register user
john is &example.User{Email:"[email protected]", Password:"john-123"}
-------------------------------
Case: Instance service
-------------------------------
--- PASS: TestExample (0.00s)
PASS
Get into the buggy line
In case of error, Biff will print something like this:
Case: Instance service
Case: Register user
john is &example.User{Email:"[email protected]", Password:"john-123"}
Case: Login
Expected: &example.User{Email:"[email protected]", Password:"1234"}
Obtained: &example.User{Email:"[email protected]", Password:"john-123"}
at biff/example.TestExample.func1.1.2(0xc420096ac0
/home/fulldump/workspace/my-project/src/example/users_test.go:84 +0x12
Navigating directly to the line where the fail was produced.
Isolated use cases
All possible bifurcations are tested in an isolated way.
BDD on the fly
You do not need to translate your tests behaviour to natural language. Biff will navigate through the execution stack and will parse portions of your testing code to pretty print your assertions.
This testing code:
a.AssertEqual(user, john)
will be printed as:
user is &example.User{Email:"[email protected]", Password:"john-123"}
Take advantage of go function scope
Avoid testing helpers and auxiliar methods to maintain the status between tests, take advantage of language varialbe scope itself to write powerful tests easy to write and easy to read.
Supported assertions
Most commonly used assertions are implemented:
AssertEqual
AssertEqualJson
AssertNil
AssertNotNil
AssertNotEqual
AssertInArray
AssertTrue
AssertFalse
Contribute
Feel free to fork, make changes and pull-request to master branch.
If you prefer, create a new issue or email me for new features, issues or whatever.
Testing
Who will test the tester? ha ha
There are no tests for the moment but there will be, sooner than later.
Example project
This project includes an example project with some naive business logic plus some Biff tests.