make all tests run in parallel

The subtests were almost all marked as parallel, but that's not enough.
That only makes the subtests run in parallel with other subtests within
the same tests, not with any other test.

Since none of the tests make use of globals nor require the entire
program to themselves, properly run all the tests in parallel.

Speeds up 'go test' on my 8-core laptop from an average of ~130s to an
average of ~50s. Many tests hit timeouts and have sleeps, so we want to
avoid running those sequentially whenever possible.
This commit is contained in:
Daniel Martí 2019-02-21 13:55:21 +01:00
parent 5ca52f3e1b
commit da4f783362
2 changed files with 36 additions and 2 deletions

View File

@ -21,10 +21,10 @@ const (
)
func TestMouseClickXY(t *testing.T) {
var err error
t.Parallel()
var err error
c := testAllocate(t, "input.html")
defer c.Release()
@ -78,6 +78,8 @@ func TestMouseClickXY(t *testing.T) {
}
func TestMouseClickNode(t *testing.T) {
t.Parallel()
tests := []struct {
sel, exp string
opt MouseOption
@ -128,6 +130,8 @@ func TestMouseClickNode(t *testing.T) {
}
func TestMouseClickOffscreenNode(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
exp int
@ -186,6 +190,8 @@ func TestMouseClickOffscreenNode(t *testing.T) {
}
func TestKeyAction(t *testing.T) {
t.Parallel()
tests := []struct {
sel, exp string
by QueryOption
@ -238,6 +244,8 @@ func TestKeyAction(t *testing.T) {
}
func TestKeyActionNode(t *testing.T) {
t.Parallel()
tests := []struct {
sel, exp string
by QueryOption

View File

@ -190,6 +190,8 @@ func TestText(t *testing.T) {
}
func TestClear(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
by QueryOption
@ -244,6 +246,8 @@ func TestClear(t *testing.T) {
}
func TestReset(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
by QueryOption
@ -315,6 +319,8 @@ func TestValue(t *testing.T) {
}
func TestSetValue(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
by QueryOption
@ -442,6 +448,8 @@ func TestAttributesAll(t *testing.T) {
}
func TestSetAttributes(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
by QueryOption
@ -547,6 +555,8 @@ func TestAttributeValue(t *testing.T) {
}
func TestSetAttributeValue(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
by QueryOption
@ -589,6 +599,8 @@ func TestSetAttributeValue(t *testing.T) {
}
func TestRemoveAttribute(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
by QueryOption
@ -626,6 +638,8 @@ func TestRemoveAttribute(t *testing.T) {
}
func TestClick(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
by QueryOption
@ -666,6 +680,8 @@ func TestClick(t *testing.T) {
}
func TestDoubleClick(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
by QueryOption
@ -703,6 +719,8 @@ func TestDoubleClick(t *testing.T) {
}
func TestSendKeys(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
by QueryOption
@ -773,6 +791,8 @@ func TestScreenshot(t *testing.T) {
}
func TestSubmit(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
by QueryOption
@ -813,6 +833,8 @@ func TestSubmit(t *testing.T) {
}
func TestComputedStyle(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
by QueryOption
@ -870,6 +892,8 @@ func TestComputedStyle(t *testing.T) {
}
func TestMatchedStyle(t *testing.T) {
t.Parallel()
tests := []struct {
sel string
by QueryOption
@ -952,6 +976,8 @@ func TestFileUpload(t *testing.T) {
for i, test := range tests {
t.Run(fmt.Sprintf("test %d", i), func(t *testing.T) {
t.Parallel()
c := testAllocate(t, "")
defer c.Release()