You can use sub-tests 

https://blog.golang.org/subtests

if you need to pass some data to a subtest you can use closures like 

func(data Data) func ( t *testing.T) {
  return func( t *testing.T) {
      print(data)
   }
}

If you need a more traditional setup/teardown fixture based test runner, 
then you need to use something else like Go convey. Granted it means slower 
tests.

Le vendredi 2 décembre 2016 14:48:53 UTC+1, Jérôme LAFORGE a écrit :
>
> Hello all,
> Do you know an elegant workaround that allows to execute extra setup on 
> each test (kind of TestMain but for each test) ?
> If not, did you plan to add this kind of feature into next release of Go ?
>
> Thank in advance.
> BR
> Jérôme
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to