gomatch alternatives and similar packages
Based on the "Testing Frameworks" category.
Alternatively, view gomatch 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 -
go-carpet
go-carpet - show test coverage in terminal for Go source files -
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 -
schema
Quick and easy expression matching for JSON schemas used in requests and responses -
gosuite
Test suites support for standard Go1.7 "testing" by leveraging Subtests feature -
testsql
Generate test data from SQL files before testing and clear it after finished.
Clean code begins in your IDE with SonarLint
Do you think we are missing an alternative of gomatch or a related project?
Popular Comparisons
README
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 case so tests are more expressive and less fragile. It can be used with both unit tests and functional tests.
When used with Gherkin driven BDD tests it makes scenarios more compact and readable. See Gherkin example
Contests
Installation
go get github.com/jfilipczyk/gomatch
Basic usage
actual := `
{
"id": 351,
"name": "John Smith",
"address": {
"city": "Boston"
}
}
`
expected := `
{
"id": "@[email protected]",
"name": "John Smith",
"address": {
"city": "@[email protected]"
}
}
`
m := gomatch.NewDefaultJSONMatcher()
ok, err := m.Match(expected, actual)
if ok {
fmt.Printf("actual JSON matches expected JSON")
} else {
fmt.Printf("actual JSON does not match expected JSON: %s", err.Error())
}
Available patterns
@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]
- unbounded array or object
Unbounded pattern
It can be used at the end of an array to allow any extra array elements:
[
"John Smith",
"Joe Doe",
"@[email protected]"
]
It can be used at the end of an object to allow any extra keys:
{
"id": 351,
"name": "John Smith",
"@[email protected]": ""
}
Gherkin example
Gomatch was created to use it together with tools like GODOG. The goal was to be able to validate JSON response focusing only on parts essential in given scenario.
Feature: User management API
In order to provide GUI for user management
As a frontent developer
I need to be able to create, retrive, update and delete users
Scenario: Get list of users sorted by username ascending
Given the database contains users:
| Username | Email |
| john.smith | [email protected] |
| alvin34 | [email protected] |
| mike1990 | [email protected] |
When I send "GET" request to "/v1/users?sortBy=username&sortDir=asc"
Then the response code should be 200
And the response body should match json:
"""
{
"items": [
{
"username": "alvin34",
"@[email protected]": ""
},
{
"username": "john.smith",
"@[email protected]": ""
},
{
"username": "mike1990",
"@[email protected]": ""
}
],
"@[email protected]": ""
}
"""
License
This library is distributed under the MIT license. Please see the LICENSE file.
Credits
This library was inspired by PHP Matcher
Logo
The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/). Gomatch logo was based on a gopher created by Takuya Ueda (https://twitter.com/tenntenn). Licensed under the Creative Commons 3.0 Attributions license. Gopher eyes were changed.
*Note that all licence references and agreements mentioned in the gomatch README section above
are relevant to that project's source code only.