mutation

package
v0.72.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func M_Array_Append_Another_Type_Item

func M_Array_Append_Another_Type_Item(currValue interface{}, fieldType string, fieldSubType string) interface{}

append one but another type, if int, then append string item, vice verse

func M_Array_Duplicate_One_Item_Random

func M_Array_Duplicate_One_Item_Random(currValue interface{}, fieldType string, fieldSubType string) interface{}

repeat one item (random)

func M_Array_Remove_One_Item_Random

func M_Array_Remove_One_Item_Random(currValue interface{}, fieldType string, fieldSubType string) interface{}

remove one (random)

func M_Array_Replace_Another_Type_Item

func M_Array_Replace_Another_Type_Item(currValue interface{}, fieldType string, fieldSubType string) interface{}

replace one (random) but another type, if int, then append string item, vice verse

func M_Array_Replace_One_Item_Bool_False

func M_Array_Replace_One_Item_Bool_False(currValue interface{}, fieldType string, fieldSubType string) interface{}

replace one (random) to bool - false

func M_Array_Replace_One_Item_Bool_True

func M_Array_Replace_One_Item_Bool_True(currValue interface{}, fieldType string, fieldSubType string) interface{}

replace one (random) to bool - true

func M_Array_Replace_One_Item_Null

func M_Array_Replace_One_Item_Null(currValue interface{}, fieldType string, fieldSubType string) interface{}

replace one (random) to nil (i.e. json null)

func M_Array_Set_Only_One_Item

func M_Array_Set_Only_One_Item(currValue interface{}, fieldType string, fieldSubType string) interface{}

just keep one item (random)

func M_Array_Set_To_Empty_Array

func M_Array_Set_To_Empty_Array(currValue interface{}, fieldType string, fieldSubType string) interface{}

< --------------- Array -------------> blank []

func M_Array_Set_To_Int

func M_Array_Set_To_Int(currValue interface{}, fieldType string, fieldSubType string) interface{}

set the [] to int

func M_Array_Set_To_Only_One_Bool_False

func M_Array_Set_To_Only_One_Bool_False(currValue interface{}, fieldType string, fieldSubType string) interface{}

set the [] has only item bool - false

func M_Array_Set_To_Only_One_Bool_True

func M_Array_Set_To_Only_One_Bool_True(currValue interface{}, fieldType string, fieldSubType string) interface{}

set the [] has only item bool - true

func M_Array_Set_To_Only_One_Int

func M_Array_Set_To_Only_One_Int(currValue interface{}, fieldType string, fieldSubType string) interface{}

set the [] has only item int

func M_Array_Set_To_Only_One_Null

func M_Array_Set_To_Only_One_Null(currValue interface{}, fieldType string, fieldSubType string) interface{}

set the [] has only item nil (i.e. json null)

func M_Array_Set_To_Only_One_String

func M_Array_Set_To_Only_One_String(currValue interface{}, fieldType string, fieldSubType string) interface{}

set the [] has only item string

func M_Array_Set_To_String

func M_Array_Set_To_String(currValue interface{}, fieldType string, fieldSubType string) interface{}

set the [] to string

func M_Bool_Set_To_Zero

func M_Bool_Set_To_Zero(currValue interface{}, fieldType string, fieldSubType string) interface{}

< --------------- Bool ------------->

func M_Char_Add_Mid_None_ASCII

func M_Char_Add_Mid_None_ASCII(currValue interface{}, fieldType string, fieldSubType string) interface{}

mid none-ascii

func M_Char_Add_Mid_One_Blank

func M_Char_Add_Mid_One_Blank(currValue interface{}, fieldType string, fieldSubType string) interface{}

mid blank

func M_Char_Add_Prefix_One_Blank

func M_Char_Add_Prefix_One_Blank(currValue interface{}, fieldType string, fieldSubType string) interface{}

---------------------------------------------- ------- other Rules ---------------------------------------------- prefix blank

func M_Char_Add_Suffix_One_Blank

func M_Char_Add_Suffix_One_Blank(currValue interface{}, fieldType string, fieldSubType string) interface{}

suffix blank

func M_Char_Repeat_50_Times

func M_Char_Repeat_50_Times(currValue interface{}, fieldType string, fieldSubType string) interface{}

longlong string

func M_Char_Replace_All_Blank

func M_Char_Replace_All_Blank(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Replace_Mid_None_ASCII

func M_Char_Replace_Mid_None_ASCII(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Replace_Mid_One_Blank

func M_Char_Replace_Mid_One_Blank(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Replace_Mid_One_E

func M_Char_Replace_Mid_One_E(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Replace_Mid_One_Negative_Sign

func M_Char_Replace_Mid_One_Negative_Sign(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Replace_Prefix_Caret

func M_Char_Replace_Prefix_Caret(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Replace_Prefix_Dollar

func M_Char_Replace_Prefix_Dollar(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Replace_Prefix_None_ASCII

func M_Char_Replace_Prefix_None_ASCII(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Replace_Prefix_One_Blank

func M_Char_Replace_Prefix_One_Blank(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Replace_Prefix_Percentage

func M_Char_Replace_Prefix_Percentage(currValue interface{}, fieldType string, fieldSubType string) interface{}

special char(s) (~!@#$%^&*()_+{}[]<>?)

func M_Char_Replace_Prefix_Point

func M_Char_Replace_Prefix_Point(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Replace_Prefix_Star

func M_Char_Replace_Prefix_Star(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Replace_Suffix_One_Blank

func M_Char_Replace_Suffix_One_Blank(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Set_To_Array

func M_Char_Set_To_Array(currValue interface{}, fieldType string, fieldSubType string) interface{}

change type (complex, i.e. object, arrary)

func M_Char_Set_To_Float

func M_Char_Set_To_Float(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Char_Set_To_Int

func M_Char_Set_To_Int(currValue interface{}, fieldType string, fieldSubType string) interface{}

change type (simple, i.e. to float64/bool...)

func M_Char_Set_To_One_Char

func M_Char_Set_To_One_Char(currValue interface{}, fieldType string, fieldSubType string) interface{}

only one char

func M_Common_Set_To_Bool_False

func M_Common_Set_To_Bool_False(currValue interface{}, fieldType string, fieldSubType string) interface{}

set the [] to bool - false

func M_Common_Set_To_Bool_True

func M_Common_Set_To_Bool_True(currValue interface{}, fieldType string, fieldSubType string) interface{}

set the [] to bool - true

func M_Common_Set_To_Empty

func M_Common_Set_To_Empty(currValue interface{}, fieldType string, fieldSubType string) interface{}

---------------------------------------------- ------- Common Rules --------- ---------------------------------------------- empty

func M_Common_Set_To_Null

func M_Common_Set_To_Null(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Common_Set_To_One_Blank

func M_Common_Set_To_One_Blank(currValue interface{}, fieldType string, fieldSubType string) interface{}

blank

func M_Common_Set_To_Single_Ampersand_Sign

func M_Common_Set_To_Single_Ampersand_Sign(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to &

func M_Common_Set_To_Single_Asterisk_Sign

func M_Common_Set_To_Single_Asterisk_Sign(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to *

func M_Common_Set_To_Single_At_Sign

func M_Common_Set_To_Single_At_Sign(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to @

func M_Common_Set_To_Single_Caret_Sign

func M_Common_Set_To_Single_Caret_Sign(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to ^

func M_Common_Set_To_Single_Dollar_Sign

func M_Common_Set_To_Single_Dollar_Sign(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to $

func M_Common_Set_To_Single_Dot_Sign

func M_Common_Set_To_Single_Dot_Sign(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to .

func M_Common_Set_To_Single_E

func M_Common_Set_To_Single_E(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to e/E, this is for MCharNumeric, which can accept only Numeric, but `e, E, -, +` sign sometimes are negeative test

func M_Common_Set_To_Single_Exclamation_Sign

func M_Common_Set_To_Single_Exclamation_Sign(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to !

func M_Common_Set_To_Single_Minus_Sign

func M_Common_Set_To_Single_Minus_Sign(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to -

func M_Common_Set_To_Single_Number_Sign

func M_Common_Set_To_Single_Number_Sign(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to #

func M_Common_Set_To_Single_Percent_Sign

func M_Common_Set_To_Single_Percent_Sign(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to %

func M_Common_Set_To_Single_Plus_Sign

func M_Common_Set_To_Single_Plus_Sign(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to +

func M_Common_Set_To_Single_e

func M_Common_Set_To_Single_e(currValue interface{}, fieldType string, fieldSubType string) interface{}

set to e/E, this is for MCharNumeric, which can accept only Numeric, but `e, E, -, +` sign sometimes are negeative test

func M_Float_Set_To_E

func M_Float_Set_To_E(currValue interface{}, fieldType string, fieldSubType string) interface{}

< --------------- Float ------------->

func M_Float_Set_To_MaxFloat32

func M_Float_Set_To_MaxFloat32(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Float_Set_To_MaxFloat64

func M_Float_Set_To_MaxFloat64(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Float_Set_To_Negative_Float

func M_Float_Set_To_Negative_Float(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Float_Set_To_Postive_Float

func M_Float_Set_To_Postive_Float(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Float_Set_To_SmallestNonzeroFloat32

func M_Float_Set_To_SmallestNonzeroFloat32(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Float_Set_To_SmallestNonzeroFloat64

func M_Float_Set_To_SmallestNonzeroFloat64(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Int_Set_To_MaxInt32

func M_Int_Set_To_MaxInt32(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Int_Set_To_MaxInt64

func M_Int_Set_To_MaxInt64(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Int_Set_To_MinInt32

func M_Int_Set_To_MinInt32(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Int_Set_To_MinInt64

func M_Int_Set_To_MinInt64(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Int_Set_To_Negative_One

func M_Int_Set_To_Negative_One(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Int_Set_To_One

func M_Int_Set_To_One(currValue interface{}, fieldType string, fieldSubType string) interface{}

func M_Int_Set_To_Zero

func M_Int_Set_To_Zero(currValue interface{}, fieldType string, fieldSubType string) interface{}

< --------------- Int ------------->

func M_Map_Set_To_Empty_Map

func M_Map_Set_To_Empty_Map(currValue interface{}, fieldType string, fieldSubType string) interface{}

< --------------- Map -------------> blank {}

func MutateTcArray

func MutateTcArray(originTcArray []*testcase.TestCaseDataInfo) []*testcase.TestCaseDataInfo

func MutationRulesMapping

func MutationRulesMapping(key string) []interface{}

Types

type MFieldDetails

type MFieldDetails struct {
	FieldPath     []string
	CurrValue     interface{}
	FieldType     string // the json supported types
	FieldSubType  string // like ip/email/phone/etc.
	MutationType  string // inner code like, MChar, MCharNumeric, etc.
	MutatedValues []*MutatedValue
}

func (*MFieldDetails) CallMutationRules

func (mFd *MFieldDetails) CallMutationRules()

fuzz - mutation

func (*MFieldDetails) DetermineMutationType

func (mFd *MFieldDetails) DetermineMutationType()

type MFunc

type MFunc struct {
	MPriority string
	MTcSuffix string
	MArea     string
	MCategory string
}

type MPForm

type MPForm struct {
	Name       string                 `json:"name"`
	Value      string                 `json:"value"`
	Type       string                 `json:"type"`
	MIMEHeader map[string]interface{} `json:"mIMEHeader"`
}

type MTestCaseDataInfo

type MTestCaseDataInfo struct {
	OriginTcD      *testcase.TestCaseDataInfo
	HContentType   interface{}                // Content-Type: multipart/form-data
	Tc4MH          *testcase.TestCaseDataInfo // for mt headers
	Tc4MQS         *testcase.TestCaseDataInfo // for mt queryString
	Tc4MPL         *testcase.TestCaseDataInfo // if multipartForm, payload without file
	TcPlType       string                     // text, multipartForm, form, <others>
	PLMPForm       PLMPForm                   // if multipartForm
	MFileIndex     []string
	MTcDs          []*testcase.TestCaseDataInfo // mutated tcds
	NextTcPriority int
}

func InitMTc

func InitMTc(originTcData *testcase.TestCaseDataInfo) MTestCaseDataInfo

func (*MTestCaseDataInfo) MAddRequestHeader

func (mTd *MTestCaseDataInfo) MAddRequestHeader(mFunc *MFunc)

func (*MTestCaseDataInfo) MAddRequestPayloadNode

func (mTd *MTestCaseDataInfo) MAddRequestPayloadNode(key string, mFds []MFieldDetails, mFunc *MFunc)

func (*MTestCaseDataInfo) MAddRequestQueryString

func (mTd *MTestCaseDataInfo) MAddRequestQueryString(mFunc *MFunc)

func (*MTestCaseDataInfo) MDelAllRequestHeaders

func (mTd *MTestCaseDataInfo) MDelAllRequestHeaders(mFunc *MFunc)

func (*MTestCaseDataInfo) MDelAllRequestQueryStrings

func (mTd *MTestCaseDataInfo) MDelAllRequestQueryStrings(mFunc *MFunc)

func (*MTestCaseDataInfo) MDelRequestHeader

func (mTd *MTestCaseDataInfo) MDelRequestHeader(mFunc *MFunc)

func (*MTestCaseDataInfo) MDelRequestPayload

func (mTd *MTestCaseDataInfo) MDelRequestPayload(key string, mFds []MFieldDetails, mFunc *MFunc)

MDelRequestPayload

func (*MTestCaseDataInfo) MDelRequestQueryString

func (mTd *MTestCaseDataInfo) MDelRequestQueryString(mFunc *MFunc)

func (*MTestCaseDataInfo) MDelWholeRequestPayloadNode

func (mTd *MTestCaseDataInfo) MDelWholeRequestPayloadNode(key string, mFds []MFieldDetails, mFunc *MFunc)

func (*MTestCaseDataInfo) MRequestHeaders

func (mTd *MTestCaseDataInfo) MRequestHeaders()

func (*MTestCaseDataInfo) MRequestPayload

func (mTd *MTestCaseDataInfo) MRequestPayload()

MutateRequestPayload

func (*MTestCaseDataInfo) MRequestQueryString

func (mTd *MTestCaseDataInfo) MRequestQueryString()

func (*MTestCaseDataInfo) MSetRequestHeader

func (mTd *MTestCaseDataInfo) MSetRequestHeader(mFunc *MFunc)

func (*MTestCaseDataInfo) MSetRequestPayload

func (mTd *MTestCaseDataInfo) MSetRequestPayload(key string, mFds []MFieldDetails, mFunc *MFunc)

MSetRequestPayload

func (*MTestCaseDataInfo) MSetRequestQueryString

func (mTd *MTestCaseDataInfo) MSetRequestQueryString(mFunc *MFunc)

type MutatedValue

type MutatedValue struct {
	MutationRule string
	MutatedValue interface{}
}

type PLMPForm

type PLMPForm []*MPForm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL