tkeel-io / tkeel

Next-generation IoT open source platform.
Apache License 2.0
94 stars 22 forks source link

[proposal] About test framework #40

Closed liuzhen21 closed 2 years ago

liuzhen21 commented 2 years ago
  1. goconvey
  2. testify

reference: vs

uptutu commented 2 years ago

I propose to use gomonkey for the mock

guoj-a commented 2 years ago

Take a look at this:

  1. GoConvey
  2. GoStub
  3. GoMock
  4. Monkey

https://www.jianshu.com/p/e3b2b1194830

uptutu commented 2 years ago

I prefer : Test Framework: testify Mock: gomonkey + gomock

That's enough.

imneov commented 2 years ago

E2E:

imneov commented 2 years ago

It's better to add some sample code

@uptutu @guoj-a

imneov commented 2 years ago

testify:

  assert.Equal(t, 123, 123, "they should be equal")
  assert.NotEqual(t, 123, 456, "they should not be equal")

goconvey:

assert.So(expr, should.NotBeNil)
assert.So(err, should.BeNil)
uptutu commented 2 years ago

testify:

  assert.Equal(t, 123, 123, "they should be equal")
  assert.NotEqual(t, 123, 456, "they should not be equal")

goconvey:

assert.So(expr, should.NotBeNil)
assert.So(err, should.BeNil)

Here are the major differences between the two.

testify is a more traditional testing framework, with 'assertions' that are common to other programming languages

goconvey is a BDD (Behavior-driven development) testing framework. The same BDD framework is also available: ginkgo

Most libraries use testify and that's what I think.