Use of Golang fuzz testing

a background

      In Go 1.18, the Go language adds fuzzing. Fuzzing, also known as fuzz testing, is called fuzz testing or random testing in Chinese. It is essentially an automated testing technique, and more specifically, it is an automated testing technique based on random input, which is often used to find bugs and problems in the code that processes user input. The main difference between fuzz testing and conventional functional testing is that during fuzz testing, the output cannot be accurately predicted because the input is uncontrollable.

Two unit tests

       Before the advent of fuzz testing, we generally used unit testing. To give an example, the general process is as follows: We have a method to flip a string; the implementation of this method is as follows:

func Reverse(s string) string {
   
    
    
    b := []byte(

Guess you like

Origin blog.csdn.net/whq19890827/article/details/129000082