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 ?