Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
triptijain2112 opened this issue May 29, 2024 · 3 comments
Labels
question Further information is requested

Comments

@triptijain2112
Copy link

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
Copy link
Author

  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

@dnephin dnephin added the question Further information is requested label May 30, 2024
@dnephin
Copy link
Member

dnephin commented May 30, 2024

Hello, try

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

@triptijain2112
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants