Testo is a modular testing framework for Go built on top of testing.T
with an extensive plugin system.
Testo (/tɛstɒ/) is a play on words "test" and "тесто", meaning "dough". Just like you can cook anything from dough, you can test anything with Testo!
See also toppings - a collection of small optional plugins for Testo.
- Plugins - hook, filter and extend
Twithout forking the framework (example). - Parametrized tests - describe a test once, repeat it with different parameters (example).
- Parallel tests - run independent tests concurrently.
- Lifecycle hooks - before and after any suite, test & sub-test (example, parallel caveat).
- Test annotations - attach static options to any test (example).
- Test filtering -
-run,-testo.m. - Informative errors and traces - error messages name the exact method and type that caused them.
- Sub-tests & sub-suites - support for nested tests and nested suites.
- Test reflection - deeply inspect test's meta-information.
- Caching - key-value storage persistent between test runs.
- Zero dependencies.
Ozon runs thousands of end-to-end tests on Testo every day.
Plugins let teams add what they need: reporting, retries, custom T
methods. Tests stay plain go test tests.
See comparison with other frameworks.
go get github.com/ozontech/testoYour first test with Testo:
package main
import (
"testing"
"github.com/ozontech/testo"
)
func Test(t *testing.T) {
testo.RunTest(t, func(t *testo.T) {
t.Log("Hello, Testo!")
})
}And run it with go test as usual:
go test .Testo can do more. For example, run parametrized tests in suite:
type Suite struct{ testo.Suite[*testo.T] }
func (Suite) CasesWord() []string {
return []string{"dough", "bread"}
}
func (Suite) TestLen(t *testo.T, p struct{ Word string }) {
if len(p.Word) == 0 {
t.Error("word must not be empty")
}
}
func TestSuite(t *testing.T) {
testo.RunSuite(t, new(Suite))
}TestLen runs once per word from CasesWord.
- Take a guided tour of Testo by making simple plugins and running the tests using various features.
- See test examples.
- Learn how to use Testo features.
- Migrating from testify or allure-go? See the migration guide.
- Read the technical overview - lifecycle, panics, plugin internals.
- View API documentation.
Plugins can:
- Provide
BeforeAll/AfterAll,BeforeEach/AfterEach&BeforeEachSub/AfterEachSubhooks. - Plan tests for execution - filter, duplicate & reorder.
- Override built-in
Tmethods, such asLogandError. - Extend
Tby adding new methods. - Allow users to configure their behavior through options.
- Communicate with other plugins.
- Add command line flags for
go testcommand.
See the guide on writing plugins.
Examples:
- Testo Allure Plugin - enhance your tests with automatically generated Allure Reports.
- Testo Rerun Plugin - adds
--last-failed-like behaviour from Pytest to Testo. Makes it possible to rerun only failed tests. - Testo XFail Plugin - adds
t.XFail()method to mark a test as "expected to fail". - Testo Parallel Plugin - marks all tests as parallel by default.
Testo has its own VS Code extension.
The extension adds run/debug buttons for individual suite tests, plus snippets.
Testo guarantees to support at least 3 latest major Go releases.
Currently, the minimum supported Go version is 1.24.
Contributions are welcome!
This project is released under the Apache-2.0 license.
