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
Copy file name to clipboardexpand all lines: en/11.3.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -92,7 +92,7 @@ The above output shows in detail the results of our test. We see that the test f
92
92
}
93
93
}
94
94
95
-
We execute `go test-v` once again. The following information should now be displayed -the test suite has passed~:
95
+
We execute `go test-v` once again. The following information should now be displayed -the test suite has passed~:
96
96
97
97
=== RUN Test_Division_1
98
98
--- PASS: Test_Division_1 (0.00 seconds)
@@ -105,14 +105,14 @@ We execute `go test-v` once again. The following information should now be displ
105
105
106
106
## How to write stress tests
107
107
108
-
Stress testing is used to detect function performance, and bears some resemblance to unit testing (which we will not get into here), however we need need to pay attention to the following points:
108
+
Stress testing is used to detect function performance, and bears some resemblance to unit testing (which we will not get into here), however we need to pay attention to the following points:
109
109
110
110
- Stress tests must follow the following format, where XXX can be any alphanumeric combination and its first letter cannot be a lowercase letter.
111
111
112
112
func BenchmarkXXX (b *testing.B){...}
113
113
114
114
- By default, `Go test` does not perform function stress tests. If you want to perform stress tests, you need to set the flag `-test.bench` with the format: `-test.bench="test_name_regex"`. For instance, to run all stress tests in your suite, you would run `go test -test.bench=".*"`.
115
-
- In your stress tests, please remember to use testing.BN any loop bodies, so that the tests can be run properly.
115
+
- In your stress tests, please remember to use testing.B.N any loop bodies, so that the tests can be run properly.
116
116
- As before, test file names must end in `_test.go`
117
117
118
118
Here we create a stress test file called webbench_test.go:
@@ -124,7 +124,7 @@ Here we create a stress test file called webbench_test.go:
0 commit comments