Repository navigation
Releases: berlin-ab/testsuite
Release list
testsuite v1.3.0 - Enforce simplicity
This release:
- removes nested suites
- enforces that hooks can only be defined once
Nested suites can lead to confusing state modifications across a large test file, making it difficult for the reader to understand what the current state of the subject under test is deep within the context. Instead, do not allow for nested suites.
Enforce that hooks can only be defined once, to force the definition of the setup/teardown logic to be easy to find and understand.
testsuite v1.2.1 - protected hooks using when
Do not allow hooks to be defined after a subsuite using When() has been defined
testsuite v1.2.0 - protected hooks
Ensure hooks are defined before starting to run tests.
v1.2.0 will panic the test if hooks are defined after starting to run the tests within the suite.
testsuite v1.1.0 - Nested suites
v1.1.0 provides the ability to specify nested suites
func TestExample(t *testing.T) {
testsuite.New(t, "defines a test suite with setup/teardown", func(s *testsuite.S) {
s.When("in a context", func(s *testsuite.S) {
s.Run("it does something in this context", func(t *testing.T) {
// defines a test using standard *testing.T
})
})
})
}
testsuite v1.0.0
testsuite provides xUnit style test suite setup and teardown behavior
for golang's testing.T library missing from the Go ecosystem:
https://awesome-go.com/testing/
Features
- SetupSuite/TeardownSuite
- Setup/Teardown per test
- Multiple suites per test function
- Simple abstraction wrapping standard testing.T