gotestsum icon indicating copy to clipboard operation
gotestsum copied to clipboard

gotestsum support to run multiple tests using fully qualified name of tests

Open triptijain2112 opened this issue 1 year ago • 3 comments

Hi all,

I am trying to run a similar below command in gotestsum to run multiple tests using fully qualified name of tests:

go repo: https://github.com/yakuter/go-test-examples go test go.mod/01-normal -v -run ^Test11$ && go test go.mod/04-testmain -v -run ^Test1$

Any suggestions how to combine these 2 commands?

triptijain2112 avatar May 29 '24 17:05 triptijain2112

  1. Is there a way to combine these 2 commands in one go test command? go test go.mod/01-normal -v -run ^Test11$ && go test go.mod/04-testmain -v -run ^Test1$

  2. How to fix this command? go test go.mod/04-testmain -v -run ^Test1$ | gotestsum --junitfile unit-tests1.xml

triptijain2112 avatar May 29 '24 17:05 triptijain2112

Hello, try

gotestsum --junitfile unit-tests1.xml -- -run '^Test1$|Test11$' 

dnephin avatar May 30 '24 02:05 dnephin

Hi @dnephin , Thanks for the suggestion, It helped!!

Do we have any way to combine the below 2 commands and generate one combined output xml file?

gotestsum --junitfile unit-tests2.xml -- go.mod/04-testmain -v -run "^Test1$" gotestsum --junitfile unit-tests2.xml -- go.mod/01-normal -v -run "^Test1$"

note: I want to provide package names to run selected tests in that package, not all tests from all packages that matches the regex.

triptijain2112 avatar May 30 '24 19:05 triptijain2112