Comments (5)
I am very much against using large frameworks for writing unit tests. Unit tests are not just for testing results, they also lock in your public API. Using a large unit tests abstraction that accepts interfaces everywhere means that type changes are possible without breaking unit tests.
If I can get an example of any test case that we feel a large testing framework is needed, I can provide potential idiomatic Go solutions instead. Just mention me and I'll be happy to help.
from opentelemetry-go.
There is consensus to use simple framework provided by Go itself.
from opentelemetry-go.
FWIW: I'm -1 on testify
, but I won't be grumbly about it if other's feel differently.
My personal testing preferences are: if's, cmp.Diff, and local helpers for anything more complex. Additionally I've seen testify stuff hide errors in the past.
from opentelemetry-go.
@freeformz can you expand on what situations you saw testify hide errors? I have been using it in opencensus-service and it is already in the codebase that we brought in. My experience with testify was positive so far and cutting the boilerplate of if cmp { log something }
has been very useful in tests.
from opentelemetry-go.
@tigrannajaryan All of the instances I can think of have been in private repos, but I have seen assert.Equal()
hide errors. Those were essentially tracked down to assert's use of interface{}
(PS: cmp.Diff suffers from this same issue, but so far I haven't been surprised by it).
FWIW: I find the ....
if tc.expected != got {
t.Errorf("expected %q, got %q", tc.expected, got)
}
AND
if diff := cmp.Diff(tc.expected, got); diff != "" {
t.Error(diff)
}
boilerplate much more consumable than assert.Equal()
and friends. For tests, they hide too much for me.
But again and since this is a personal preference thing, I won't complain further (at least not now or for a while) if others vote in favor of testify
WRT opensensus-service, only the following packages use testify's assert package:
"github.com/census-instrumentation/opencensus-service/cmd/occollector/app/builder"
"github.com/census-instrumentation/opencensus-service/exporter/opencensusexporter"
"github.com/census-instrumentation/opencensus-service/internal/configv2"
"github.com/census-instrumentation/opencensus-service/processor/addattributesprocessor"
"github.com/census-instrumentation/opencensus-service/receiver/jaegerreceiver"
"github.com/census-instrumentation/opencensus-service/receiver/opencensusreceiver"
There are 37 other packages that do not.
from opentelemetry-go.
Related Issues (20)
- Add the `log/embedded` package
- Add the `log/noop` package HOT 1
- Implement the `Logger` configuration
- Add tests for the `Severity` type
- Implement the `Record` type
- Implement the `Value` and `KeyValue` types HOT 5
- Add benchmarks to `log` package HOT 1
- Add allocation unit tests to `log` package HOT 1
- Replace `List` log value kind with `Slice` HOT 3
- Go semver seems not be consistant with otel semver spec HOT 7
- baggage: Accept non-ASCII keys HOT 8
- Create Logs Bridge SDK Design Proposal HOT 3
- internal/global: Export getLogger and refactor tests
- log: Implement Stringer for Value and KeyValue HOT 3
- log: Empty Value
- Conflicting schema with stdouttrace HOT 2
- Release v1.24.0/v0.46.0 Checklist
- Remove the AsAny method from `Value`
- Create an assertZeroAllocs test helper HOT 2
- log: Add global LoggerProvider HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentelemetry-go.