Repository navigation
Expand file tree
/
Copy pathdoc.go
More file actions
76 lines (76 loc) · 1.51 KB
/
Copy pathdoc.go
File metadata and controls
76 lines (76 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Package testo is a modular testing framework built on top of [testing.T].
// It is focused on suite based tests and has an extensive plugin system.
//
// # Quick Start
//
// A minimal working example looks like this:
//
// package main
//
// import (
// "testing"
//
// "github.com/ozontech/testo"
// )
//
// func Test(t *testing.T) {
// testo.RunTest(t, func(t *testo.T) {
// t.Log("Hello, Testo!")
// })
// }
//
// # Plugins
//
// Plugins are the core feature of Testo.
// Plugins can generate reports, add custom methods to T,
// override built-in methods, plan test execution and more.
//
// Plugins are installed by defining our own T with embedded [T] and plugins:
//
// type T struct {
// *testo.T
// *myplugin.PluginFoo
// *myplugin.PluginBar
// }
//
// func Test(t *testing.T) {
// testo.RunTest(t, func(t T) {
// t.Log("Hello, Testo!")
// })
// }
//
// Notice that we now use our T instead of *testo.T in a test.
//
// # Suites & Standalone Tests
//
// Testo supports several ways to run tests.
//
// Suites:
//
// type Suite struct { testo.Suite[T] }
//
// func (Suite) TestFoo(t T) { t.Log("Foo") }
// func (Suite) TestBar(t T) { t.Log("Bar") }
//
// func Test(t *testing.T) {
// testo.RunSuite(t, new(Suite))
// }
//
// Standalone:
//
// func TestFoo(t *testing.T) {
// testo.RunTest(t, func(t T) {
// t.Log("Foo")
// })
// }
//
// func Test(t *testing.T) {
// t.Run("Foo", testo.Test(func(t T) {
// t.Log("Foo")
// }))
//
// t.Run("Bar", testo.Test(func(t T) {
// t.Log("Bar")
// }))
// }
package testo