ZhangZhihui's Blog  
上一页 1 ··· 92 93 94 95 96 97 98 99 100 ··· 115 下一页

2023年10月23日

摘要: package main import ( "fmt" ) type Person struct { Name string Age int Email string } func main() { p := Person{ Name: "Drake", Age: 35, Email: "drake 阅读全文
posted @ 2023-10-23 20:38 ZhangZhihuiAAA 阅读(20) 评论(0) 推荐(0)

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 阅读(25) 评论(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 阅读(33) 评论(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 阅读(22) 评论(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 阅读(28) 评论(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 阅读(38) 评论(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 阅读(18) 评论(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 阅读(22) 评论(0) 推荐(0)

2023年10月17日

摘要: Problem: You want to make an HTTP request to a web server. Solution: Use the net/http package to make an HTTP request. HTTP is a request-respond proto 阅读全文
posted @ 2023-10-17 22:26 ZhangZhihuiAAA 阅读(30) 评论(0) 推荐(0)
 
摘要: Problem: You want to use Go’s templating system to create a web application. Solution: Use the html/template package to create a web application. pack 阅读全文
posted @ 2023-10-17 21:49 ZhangZhihuiAAA 阅读(24) 评论(0) 推荐(0)
上一页 1 ··· 92 93 94 95 96 97 98 99 100 ··· 115 下一页