You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of issue or feature request:
Right now, we call a TestMain method to create a test directory, copy over all our test files and work on this directory for each test. This can be dangerous, because tests are sharing states. Just imagine a test, that does not clean up properly or that alters one of our test files. The solution is to create a helper function, that creates a separate test directory for each function.
The disadvantage would be to have to call that function in every test, the benefit would be an isolated test environment for each test. We can make use of T.TempDir for this. T.TempDir is new in Go 1.15 and will cleanup the test directory automatically, when exiting the function.
Current behavior:
One big test directory for all tests
Expected behavior:
We should create an isolated test directory for each step.
The text was updated successfully, but these errors were encountered:
Description of issue or feature request:
Right now, we call a TestMain method to create a test directory, copy over all our test files and work on this directory for each test. This can be dangerous, because tests are sharing states. Just imagine a test, that does not clean up properly or that alters one of our test files. The solution is to create a helper function, that creates a separate test directory for each function.
The disadvantage would be to have to call that function in every test, the benefit would be an isolated test environment for each test. We can make use of
T.TempDir
for this.T.TempDir
is new in Go 1.15 and will cleanup the test directory automatically, when exiting the function.Current behavior:
One big test directory for all tests
Expected behavior:
We should create an isolated test directory for each step.
The text was updated successfully, but these errors were encountered: