ZhangZhihui's Blog  

2023年10月18日

摘要: Problem: You want to run performance tests for a specific duration or a specific number of iterations. Solution: You can increase the minimum duration 阅读全文
posted @ 2023-10-18 20:12 ZhangZhihuiAAA 阅读(6) 评论(0) 推荐(0) 编辑
 
摘要: Problem: You want to customize the performance tests to avoid benchmarking test fixtures. Solution: You can start, stop, and reset the benchmark timer 阅读全文
posted @ 2023-10-18 20:07 ZhangZhihuiAAA 阅读(11) 评论(0) 推荐(0) 编辑
 
摘要: Problem: You want to do unit testing on a web application or a web service. Solution: Use the httptest.NewRecorder function to create an httptest.Resp 阅读全文
posted @ 2023-10-18 19:02 ZhangZhihuiAAA 阅读(3) 评论(0) 推荐(0) 编辑
 
摘要: Problem: You want to generate random test data for running your test functions. Solution: Use fuzzing , which is an automated testing technique to gen 阅读全文
posted @ 2023-10-18 18:50 ZhangZhihuiAAA 阅读(6) 评论(0) 推荐(0) 编辑
 
摘要: Problem: You want to speed up testing by running tests in parallel. Solution: Use the t.Parallel function to enable tests or subtests to run in parall 阅读全文
posted @ 2023-10-18 16:52 ZhangZhihuiAAA 阅读(10) 评论(0) 推荐(0) 编辑
 
摘要: Problem: You want to create subtests within a test function to have finer control over test cases. Solution: Use the t.Run function to create subtests 阅读全文
posted @ 2023-10-18 16:24 ZhangZhihuiAAA 阅读(3) 评论(0) 推荐(0) 编辑
 
摘要: Problem: You want to set up data and an environment for testing and tear it down after the test is run. Solution: You can create helper functions or u 阅读全文
posted @ 2023-10-18 09:53 ZhangZhihuiAAA 阅读(2) 评论(0) 推荐(0) 编辑