ppparihar / GoTestExplorer

A Go Test Explorer for VS code (https://marketplace.visualstudio.com/items?itemName=premparihar.gotestexplorer)
46 stars 8 forks source link

Including tests from stretchr/testify #12

Open brunopiaui opened 5 years ago

brunopiaui commented 5 years ago

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.

ppparihar commented 5 years ago

Let me check if it's feasible.

ppparihar commented 5 years ago

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

brunopiaui commented 5 years ago

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