Documentation ¶
Index ¶
- func GetBoolArrayFromTextFile(filename string) ([]bool, error)
- func GetFloatArrayFromTextFile(filename string) ([]float64, error)
- func GetIntArrayFromTextFile(filename string) ([]int, error)
- func GetStringArrayFromTextFile(filename string) ([]string, error)
- func RunIntruderTests(t *testing.T, ctx context.Context, td testdeck.TestCase, client interface{}, ...)
- func TestThisField(t *testing.T, ctx context.Context, tc testdeck.TestCase, client interface{}, ...)
- func VerifyIntruderTestResults(t *testdeck.TD, data JsonDataSet, res interface{}, duration time.Duration, ...)
- type ExpectedResult
- type InputValidationTestData
- type JsonDataSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBoolArrayFromTextFile ¶
Parses an intruder .txt file into a bool array
func GetFloatArrayFromTextFile ¶
Parses an intruder .txt file into a float array
func GetIntArrayFromTextFile ¶
Parses an intruder .txt file into an int array
func GetStringArrayFromTextFile ¶
Parses an intruder .txt file into a string array
func RunIntruderTests ¶
func RunIntruderTests(t *testing.T, ctx context.Context, td testdeck.TestCase, client interface{}, methodName string, req interface{}, data InputValidationTestData)
Runs a fuzz test on all parameters of this request req is a sample request struct specified in the protobuf file (e.g. pb.SayRequest) function is the function to be called dataFile is the json file where fuzzing data will come from
func TestThisField ¶
func TestThisField(t *testing.T, ctx context.Context, tc testdeck.TestCase, client interface{}, methodName string, req interface{}, fieldName string, testDataSet InputValidationTestData)
This method generates an actual testdeck test case to fuzz the specified field req is the sample request struct fieldName is the current field to fuzz function is the fuzzing function dataFile is the json file where fuzzing data will come from
func VerifyIntruderTestResults ¶
func VerifyIntruderTestResults(t *testdeck.TD, data JsonDataSet, res interface{}, duration time.Duration, input string, err error)
A helper function that verifies that the response matches the expected results fetched from the json test data file
Types ¶
type ExpectedResult ¶
type InputValidationTestData ¶
type InputValidationTestData struct { Strings []JsonDataSet `json:"string"` Ints []JsonDataSet `json:"int"` Floats []JsonDataSet `json:"float"` Bools []JsonDataSet `json:"bool"` }
data for testing input validation test data need to be separated by data type so that the fuzzer can feed the proper data type into the parameter
func ParseInputValidationTestDataFromJson ¶
func ParseInputValidationTestDataFromJson(file string) (InputValidationTestData, error)
Parse input validation json testdata data into a struct
type JsonDataSet ¶
type JsonDataSet struct { Files []string `json:"files"` Type string `json:"type"` Expected ExpectedResult `json:"expected"` }
represents a json data set Files is the list of intruder .txt files to use Expected is the expected result