Can I run go tests programmatically?

303 views
Skip to first unread message

Jake Brukhman

unread,
Oct 28, 2012, 4:20:00 PM10/28/12
to golan...@googlegroups.com
I see testing.RunTests, but it's not clear if this function is actually meant for this purpose (or how to use it effectively).

Let me discuss the larger issue. I have a suite of tests which is quite large and scattered across many files, and all tests depend on an extremely expensive setup of a universal test context. Thus, I want to perform this setup once before any tests are run and I want to ideally tear it down afterwards, though the latter is not crucial.

I am aware of gocheck, I was just wondering if there is any pure-Go solution here.

Thanks,
Jake

Rémy Oudompheng

unread,
Oct 28, 2012, 4:21:32 PM10/28/12
to Jake Brukhman, golan...@googlegroups.com
On 2012/10/28 Jake Brukhman <jbr...@gmail.com> wrote:
> I see testing.RunTests, but it's not clear if this function is actually
> meant for this purpose (or how to use it effectively).
>
> Let me discuss the larger issue. I have a suite of tests which is quite
> large and scattered across many files, and all tests depend on an extremely
> expensive setup of a universal test context. Thus, I want to perform this
> setup once before any tests are run and I want to ideally tear it down
> afterwards, though the latter is not crucial.

If *all* your tests depend on the initial setup, run the initial setup
in an init() function.

Rémy.
Reply all
Reply to author
Forward
0 new messages