GoTestExplorer icon indicating copy to clipboard operation
GoTestExplorer copied to clipboard

Including tests from stretchr/testify

Open brunopiaui opened this issue 6 years ago • 4 comments

Hi, Your extension is awesome!! I would like to know if you can add the tests made from stretchr/testify lib?

package models

import (
	"testing"

	"github.com/cryo-management/api/common"
	"github.com/cryo-management/api/db"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/suite"

	_ "github.com/lib/pq"
)

// Define the suite, and absorb the built-in basic suite
// functionality from testify - including assertion methods.
type SchemaTestSuite struct {
	suite.Suite
}

// Make sure that VariableThatShouldStartAtFive is set to five
// before each test
func (suite *SchemaTestSuite) SetupTest() {
	_ = db.Connect()
}

// All methods that begin with "Test" are run as tests within a
// suite.
func (suite *SchemaTestSuite) TestLoad() {
	s := new(Schema)
	s.Load("SC016")
	assert.Equal(suite.T(), "SC016", s.Code, "invalid generated query")
}

// In order for 'go test' to run this suite, we need to create
// a normal test function and pass our suite to suite.Run
func TestSchemaTestSuite(t *testing.T) {
	suite.Run(t, new(SchemaTestSuite))
}

Show only the TestSchemaTestSuite.

brunopiaui avatar Apr 12 '19 11:04 brunopiaui

Let me check if it's feasible.

ppparihar avatar Apr 12 '19 17:04 ppparihar

@brunopiaui Thank you for providing a valuable suggestion. I have checked and found it's feasible to support this lib. I will be working on the design to have this support and will update here once the pr is ready for it.

ppparihar avatar Apr 14 '19 19:04 ppparihar

Great!!! You should include a donation link in your project 😁. Thanks!

brunopiaui avatar Apr 15 '19 13:04 brunopiaui

Any updates on this support? Currently, only the start test function is working,the other methods arent.

caioreix avatar Jan 06 '25 17:01 caioreix