A couple of additional possibilities might be to use the -short flag (have 
network dependent tests look at testing.Short() and skip) or using environment 
variables (only run network tests when some variable is set).

//jb

On 8 Feb 2021, at 15:03, Johan Martinsson <martinsson.jo...@gmail.com> wrote:

I would like to separate my tests into different test suites. The first one is 
the regular unit tests and the second one is tests that might fail from time to 
time (they include external web services).

The ways to do this go that I have found are

  1.  Use build tags
  2.  Provide a list of files to go test
  3.  Use the -run flag and a regex of test method names

However none fits my need:

1.
I'm not happy with it as if I don't want to run the unit tests in the second 
suite, then I have to add a build-flag to my unit tests as well

2.
All files have to be in the same directory. I could put all those tests in one 
directory, but I want to keep my test files where they belong from a functional 
view

3.
Same problem as 2. everything has to be in the same directory

Am I missing some option here?


--
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<mailto:golang-nuts+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/89989af1-9435-4ea7-b776-b1fd431bbd56n%40googlegroups.com<https://groups.google.com/d/msgid/golang-nuts/89989af1-9435-4ea7-b776-b1fd431bbd56n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0D3B9C21-4045-4C3D-AAE8-A30FDE038F7D%40kastelo.net.

Reply via email to