善用 Go Fuzzing,幫助你寫出更完整的單元測試 func Pow(base uint, exponent uint) uint { if exponent == 0 { return 1 } return base * Pow(base, exponent-1) } func FuzzPow(f *testing.F) { f.Fuzz(func(t *testing.T, x, y uint) { …
Testing
All posts
Nginx 使用 split_clients 进行简易 A/B 测试 ngx_http_split_clients_module configure 这里举例,我们想要 20% 的用户跳转到网址 https://example.com/,30% 的用户跳转到网址 https://example.org/,剩下的跳转到网址 https://examle.edu/ split_clients …
Dockertest 极速搭建集成测试环境神器 dockertest
Golang 基准测试 基本使用 基准测试常用于代码性能测试,函数需要导入 testing 包,并定义以 Benchmark 开头的函数, 参数为 testing.B 指针类型,在测试函数中循环调用函数多次 ➜ go test -bench=. -run=none goos: darwin goarch: amd64 pkg: pkg06 cpu: Intel(R) Core(TM) i7-8850H CPU @ …