Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RuntimeTest func(t *testing.T)
Functions ¶
func PackageDirectory ¶
func PackageDirectory() string
PackageDirectory returns package path of the test's Test...() function. This function works as following:
It traces back the call stack using runtime, ignoring test utility packages like "test", "test/utils", "testdata" and "runtime, until it find golang's "testing" package. The last seen package is considered the package of Test...().
Limitation:
- This function would not work in tests that have their directory ending with "test" and "test/utils" The workaround is to set RuntimeTest to one of the test function.
- THis function would not work in any "testdata" directory. There is no workaround.
func ProjectDirectory ¶
func ProjectDirectory() string
ProjectDirectory returns the directory of test's project root (directory containing go.mod). Note: this function leverage PackageDirectory(), so same limitation applies
Types ¶
Click to show internal directories.
Click to hide internal directories.