https://github.com/ibllex/suite
Simple and lightweight test suite for Go.
https://github.com/ibllex/suite
golang suite testing
Last synced: 5 months ago
JSON representation
Simple and lightweight test suite for Go.
- Host: GitHub
- URL: https://github.com/ibllex/suite
- Owner: ibllex
- License: mit
- Created: 2021-05-22T15:28:15.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-22T16:02:15.000Z (about 5 years ago)
- Last Synced: 2025-06-19T20:03:20.351Z (about 1 year ago)
- Topics: golang, suite, testing
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Suite
Simple and lightweight test suite for Go.
## Features
1. Support test group.
2. `Setup` and `TearDown` hooks for each suite and test case.
3. Use the `SUITE_RUN` environment variable to run the specified test.
## Quick Start
```go
package suite_test
import (
"testing"
"github.com/ibllex/suite"
)
// UserTest is a valid test suite.
// You don’t need to implement all the suite hooks.
// This example is just for completeness.
// So, just implement what you need.
type UserTest struct{}
// SetupSuite will run once before all test cases are run
func (s *UserTest) SetupSuite(t *testing.T) {
//
}
// TearDownSuite will run once after all test cases are run
func (s *UserTest) TearDownSuite(t *testing.T) {
//
}
// SetupTest will run before each test case is run
func (s *UserTest) SetupTest(t *testing.T) {
//
}
// TearDownTest will run after each test case is run
func (s *UserTest) TearDownTest(t *testing.T) {
//
}
// Every test case function in a suite should start with `Test` prefix
func (s *UserTest) TestCreateUser(t *testing.T) {
//
}
func (s *UserTest) TestDeleteUser(t *testing.T) {
//
}
func (s *UserTest) TestUpdateUser(t *testing.T) {
//
}
// TestUser run the suite
func TestUser(t *testing.T) {
suite.Run(t, &UserTest{})
}
```
## License
This library is under the [MIT](https://github.com/ibllex/suite/blob/main/LICENSE) license.