Skip to content

Commit 85ae9d1

Browse files
committed
docs: document seed input sources for @fuzztest
1 parent 94ea994 commit 85ae9d1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,21 @@ For example, if the fuzz test is in the class `src/test/java/com/example/ValidFu
200200
If this directory does not exist, Jazzer will save crash inputs in the directory from which the tests are executed.
201201
202202
203+
## Seeding via JUnit parameter sources
204+
205+
You can provide initial seed inputs for a `@FuzzTest` using standard JUnit parameter sources such as `@MethodSource`,
206+
`@CsvSource`, `@ValueSource`, or custom `@ArgumentsSource`. In [regression mode](#regression-mode), Jazzer executes the
207+
fuzz test once for each provided argument set, similar to a JUnit `@ParameterizedTest`.
208+
In [fuzzing mode](#fuzzing-mode), the seed inputs are additionally used for further mutations.
209+
210+
An example showcasing JUnit’s `@MethodSource` for a `@FuzzTest` can be found in
211+
[`JavaSeedFuzzTest.java`](examples/junit/src/test/java/com/example/JavaSeedFuzzTest.java).
212+
213+
Note that classes without corresponding getter functions (i.e. that are mutated by the
214+
[`CachedConstructorMutatorFactory`](src/main/java/com/code_intelligence/jazzer/mutation/mutator/aggregate/CachedConstructorMutatorFactory.java))
215+
can not be serialized when used in a `@MethodSource` method. Test cases including such objects will be ignored with a
216+
warning during Jazzer startup.
217+
203218
## Sanitizers / bug detectors
204219
205220
Sanitizers (also called *bug detectors*) are built-in checks that help Jazzer find security issues in your application while fuzzing.

0 commit comments

Comments
 (0)