Te

Testy, a better Golang testing library

Hacker News

Testy, a better Golang testing library

Hi HN, I'd like to show you Testy [0], a small testing library for golang that I've just released today. Golang is interesting because it has an extremely powerful builtin testing framework, `testing`, that supports both soft and hard checks/assertions. Soft checks mark the test as failed but allow it to continue running. Hard checks mark the test as failed and immediately cause it to end, like asserts traditionally do in most languages. There are a few established testing libraries ( testify [1], gotest.tools [2], and is [3]) that take advantage of this in various ways, but they each have drawbacks. - testify supports both hard and soft style checks. They call the soft checks "asserts", and the hard checks "requires", to the confusion of all. Their API has a massive surface area, which is confusing for developers trying to write tests. It uses `reflect.DeepEquals` for deep equality, which is painful for common operations like comparing `time.Time` structs. And their API isn't typesafe, so refactoring existing tests is a pain. - gotest.tools has a smaller API surface area, and does some cool tricks with AST parsing in order to show meaningful failure messages. It uses `go-cmp` for deep equality, which is the right choice. But the API is confusing, the not typesafe, and it doesn't have soft style checks for everything. - is has a too-small API surface area, to the point that it's missing NotEquals checks. It is also built around `reflect.DeepEquals`, and is not typesafe. Testy, my new library, addresses all of these issues. It's typesafe, using generics. It uses `go-cmp` for deep equality testing. It has soft checks and hard asserts. It has a small, but sufficient, API surface area that makes it easy to learn and use. And it comes with structural helpers for giving your tests clearer meaning and failure output, making your tests more useful. Give it a shot and let me know what you think! My one big question is whether or not to expand the surface area of the API and add more helpers, for things like comparing lengths, checking whether or not an object is in a slice or map, etc. Comments and feedback appreciated greatly! [0] https://github.com/peterldowns/testy [1] https://github.com/stretchr/testify [2] https://github.com/gotestyourself/gotest.tools [3] https://github.com/matryer/is

Share card

Actual performance

2points
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Strong signals: supports · Missing: reddit linkedin, podcasting, created
67%67% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Product HuntOn track for Day 1 leaderboard · Strong signals: new, using · Missing: mac, agents, macos
63%63% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Strong signals: way · Missing: mobile apps, ios, personal
41%41% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Hacker NewsMay not resonate with HN audience · Strong signals: just released, exist, existing · Missing: https docs, excited, lua
39%39% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
30%30% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
14%14% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Fa
Fault injection library for testing28%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Fault injection library for testing

Hacker News3
A
A compile testing library for Kotlin41%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A compile testing library for Kotlin

Hacker News3
As
Assert: testing and assertion library on top of Go generics39%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Assert: testing and assertion library on top of Go generics

Hacker News3
CL
CLI Testing Library35%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

CLI Testing Library

Hacker News2
Fr
Fruitstand – A Library for Regression Testing LLMs43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Fruitstand – A Library for Regression Testing LLMs

Hacker News1
Be
Better API Testing with Portman48%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Better API Testing with Portman

Hacker News1
Li
Library for Bayesian A/B Testing with an emphasis on documentation45%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Library for Bayesian A/B Testing with an emphasis on documentation

Hacker News3
St
Stop a/b testing – here’s something better49%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Stop a/b testing – here’s something better

Hacker News4
He
Heyya v1.0.0 Elixir and Phoenix LiveView Snapshot Testing Library45%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Heyya v1.0.0 Elixir and Phoenix LiveView Snapshot Testing Library

Hacker News9
To
Touca – a better alternative to snapshot testing63%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Touca – a better alternative to snapshot testing

Hacker News63