Giter Site home page Giter Site logo

Comments (5)

cstockton avatar cstockton commented on July 22, 2024 2

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.

rghetia avatar rghetia commented on July 22, 2024 1

There is consensus to use simple framework provided by Go itself.

from opentelemetry-go.

freeformz avatar freeformz commented on July 22, 2024

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.

tigrannajaryan avatar tigrannajaryan commented on July 22, 2024

@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.

freeformz avatar freeformz commented on July 22, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.