testify
testify copied to clipboard
Set up objects once and reuse across multipe suites/tests
Hello, I am wondering if testify has test session level capabilities, similar to frameworks like python or nunit ? If not, has anyone come up with an efficient way of reusing instantiated objects across multiple suites, without having to call the same boilerplate code over again ?
Pytest example:
@pytest.fixture(scope="session")
def create_client_once():
## code to create http client once..
yield client
May be I got you wrong, but it's possible to create them on package level and use them from functions. Like
package main_test
var (
someIntance *client
)
func TestSomeThing(t *testing.T) {
...
}