Reputation: 11582
I am writing tests for my go code and inside sender folder, sender package I have added exposed_api_test.go
( also tried exposed_api_test.go
because I have code in exposed_api.go
)
package sender
import (
"log"
"testing"
"github.com/stretchr/testify/assert"
)
func TestTimeConsuming(t *testing.T) {
assert.Equal(t, "test", "test1")
}
and when I run build and run command go test my_project
I get ? my_project [no test files]
When I put test out of this package ( in main
package same test but package main
) and execute same command I get that test from main executed.
What is a problem and how to call tests inside other packages other than main ?
Upvotes: 0
Views: 59
Reputation: 7324
Try this:
go test my_project/...
Or if you are within your project:
go test ./...
Upvotes: 1