-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Milestone
Description
The testing framework of go is powerful, one of it's strong points is it's natural ability to run tests in parallel.
I assert that most tests should be able to run in parallel, and if not - a detailed explanation should be given why this test should run on its own. I can gather several reasons for this proposal:
- Faster tests: running all possible tests in parallel will result in shorter test time.
- Explicitly: Having a programmer write an explicit reason for the test not to be able run in parallel:
t.Serial("Modifies a database which is used by several tests"). - Bugs detection: running tests in parallel is one of the ways to detect bugs in program design, which might be hidden in a serial invocation of the tests.
- Less code/ Programmer friendlier: almost every test deceleration takes two lines of code: the test function deceleration and a following line
t.Parallel(). It is a common case to see only the first, and the main reason for that is the the programmer forgot to type the second.
I can propose two ways to accept this change:
- Breaking change: save it to Go2, since Go1 is good enough as it is. 😄
- Can add an additional flag for the test command that sets the default behavior to parallel, unless the
Serialfunction was called on a test.
Reactions are currently unavailable