ZhangZhihui's Blog |
|
||
2023年11月13日
摘要:
To have data consistency in a distributed system, you have two options: a two-phase commit (2PC) and saga. 2PC coordinates all the processes that form 阅读全文
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 阅读全文
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 阅读全文
摘要:
Problem: You want to customize the performance tests to avoid benchmarking test fixtures. Solution: You can start, stop, and reset the benchmark timer 阅读全文
摘要:
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 阅读全文
摘要:
Problem: You want to generate random test data for running your test functions. Solution: Use fuzzing , which is an automated testing technique to gen 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
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 阅读全文
|
Copyright © 2024 ZhangZhihuiAAA
Powered by .NET 9.0 on Kubernetes |