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)
- Move from build-tools to weaver HOT 1
- Audit Compliance: Logs Bridge API Logger Provider
- Audit Compliance: Logs Bridge API Logger
- Audit Compliance: Logs Bridge API Concurrency Requirements
- Audit Compliance: Logs Bridge API Artifact Naming
- Audit Compliance: Logs Bridge SDK Logger Provider
- Audit Compliance: Logs Bridge SDK Logger
- Audit Compliance: Logs Bridge SDK ReadableLogRecord HOT 1
- Audit Compliance: Logs Bridge SDK ReadWriteLogRecord HOT 1
- Audit Compliance: Logs Bridge SDK LogRecord Limits
- Audit Compliance: Logs Bridge SDK LogRecordProcessor Interface
- Audit Compliance: Logs Bridge SDK Bult-in LogRecord Processors
- Audit Compliance: Logs Bridge SDK Log Record Exporter
- Audit Compliance: Logs Bridge No-Op Implementation
- SetAttributes/AddAttributes truncate strings down to 0-length HOT 5
- log: Add noCmp fields
- Update the no-op trace implementations to support auto-instrumentation
- How to Ignore `context.Canceled` Error HOT 1
- Otlp: `too many colons in address` when export env: `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` HOT 3
- [new feature] metrics: support prometheus remote write exporter.
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.