Pool of initial seeds for input
enzocardeal opened this issue · 1 comments
I' d like to create a pool of initial seeds for test inputs so I can assure that my test will branch deeply in the login routine (with known good user and password) under fuzz testing. Is it possible?
Thank you,
Yes, in general you can provide a directory of seed inputs via mvn jqf:fuzz -Dinput=<dir>
, with one file (any name) per distinct "input". However, the "input" here is the encoding of choices made by the generators to your parametrized test method, and so may not be human readable. If you have run the fuzzer for a while and see coverage-increasing results in fuzz-results/corpus
or equivalent, then those files can be assumed to be in the correct format to be used as seed inputs for a future fuzzing run.
If you want the files to be human readable so that you can edit them by hand, then either your test method should take in exactly one input of type InputStream
OR it can take in a single String
input and explicitly use the ArbitraryLengthGenerator
(see the RegEx example for usage).
If your test method has multiple parameters or non-String type inputs, then enforcing a human readable file format for seed inputs is usually harder and not supported out of the box (though you can certainly build a custom solution once you figure out the mechanics of input files and generator choices).