lundi 20 mai 2019

prefix testmain on multiple instance

I am using TestMain to test multiple implementation of the same interface

func TestMain(m *testing.M) {
    setup1()
    code = m.Run()
    os.exit(code)

    setup2()
    code = m.Run()
    os.exit(code)
}

If I then get an error in a test, it is difficult to know which implementation generated the failure

In T subtests, you run like this :

t.run("test name", testfunc)

is there a way to do something to prefix the Main tests

m.Run("name") // intuitively what I should be able to do

Aucun commentaire:

Enregistrer un commentaire