-
Notifications
You must be signed in to change notification settings - Fork 42
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
Improve Tests using TestMain() #142
Comments
Joined with #286 |
Reduce global variables. CLI parameter values could be in function parameters for testing. For cleaner function interfaces use wrapper functions. Not sure if the is a good idea. |
Each package is compiled for testing in a separate binary and they are tested are tested parallel. The tests inside a package are tested sequentially. Therefore each test needs to set the global variables it uses. That is implemented in the id package tests. Test Main() could be used if packages share the same external resource, like til.json. Because we use afero for the tests, this is right now no issue anymore. |
Can set global vars to different values and repeat the call of m.Run() but this will cause some tests to be called parallel and result in some fails. Needs further investigation. See file update_whitebox_test.go as example.
The text was updated successfully, but these errors were encountered: