You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<divclass="type-signature"><spanclass="annotations"><ahref="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/Target.html" title="class or interface in java.lang.annotation" class="external-link">@Target</a>(<ahref="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/ElementType.html#METHOD" title="class or interface in java.lang.annotation" class="external-link">METHOD</a>)
70
+
<divclass="type-signature"><spanclass="annotations"><ahref="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/Target.html" title="class or interface in java.lang.annotation" class="external-link">@Target</a>({<ahref="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/ElementType.html#METHOD" title="class or interface in java.lang.annotation" class="external-link">METHOD</a>,<ahref="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/ElementType.html#ANNOTATION_TYPE" title="class or interface in java.lang.annotation" class="external-link">ANNOTATION_TYPE</a>})
71
71
<ahref="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/Retention.html" title="class or interface in java.lang.annotation" class="external-link">@Retention</a>(<ahref="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/RetentionPolicy.html#RUNTIME" title="class or interface in java.lang.annotation" class="external-link">RUNTIME</a>)
72
72
<ahref="https://junit.org/junit5/docs/current/api/org.junit.jupiter.params/org/junit/jupiter/params/provider/ArgumentsSource.html" title="class or interface in org.junit.jupiter.params.provider" class="external-link">@ArgumentsSource</a>(com.code_intelligence.jazzer.junit.SeedArgumentsProvider.class)
73
73
<ahref="https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtendWith.html" title="class or interface in org.junit.jupiter.api.extension" class="external-link">@ExtendWith</a>(com.code_intelligence.jazzer.junit.FuzzTestExtensions.class)
@@ -81,28 +81,32 @@ <h2>Test parameters</h2>
81
81
<p>Methods annotated with <ahref="FuzzTest.html" title="annotation interface in com.code_intelligence.jazzer.junit"><code>FuzzTest</code></a> can take either of the following types of parameters:
82
82
83
83
<dl>
84
-
<dt><code>byte[]</code></dt>
85
-
<dd>Raw byte input mutated by the fuzzer. Use this signature when your fuzz test naturally
86
-
handles raw bytes (e.g. when fuzzing a binary format parser). This is the most efficient, but
87
-
also the least convenient way to write a fuzz test.</dd>
88
-
89
-
<dt><ahref="https://codeintelligencetesting.github.io/jazzer-docs/jazzer-api/com/code_intelligence/jazzer/api/FuzzedDataProvider.html" title="class or interface in com.code_intelligence.jazzer.api" class="external-link"><code>FuzzedDataProvider</code></a></dt>
90
-
<dd>Provides convenience methods that generate instances of commonly used Java types from the raw
91
-
fuzzer input. This is generally the best way to write fuzz tests.</dd>
92
-
93
-
<dt>any non-zero number of parameters of any type</dt>
94
-
<dd>In this case, Jazzer will rely on reflection and class path scanning to instantiate concrete
95
-
arguments. While convenient and a good way to get started, fuzz tests using this feature will
96
-
generally be less efficient than fuzz tests using any of the other possible signatures. Due to
97
-
the reliance on class path scanning, any change to the class path may also render previous
98
-
findings unreproducible.</dd>
84
+
<dt><code>byte[]</code>
85
+
<dd>Raw byte input mutated by the fuzzer. Use this signature when your fuzz test naturally
86
+
handles raw bytes (e.g. when fuzzing a binary format parser). This is the most efficient,
87
+
but also the least convenient way to write a fuzz test.
88
+
<dt><ahref="https://codeintelligencetesting.github.io/jazzer-docs/jazzer-api/com/code_intelligence/jazzer/api/FuzzedDataProvider.html" title="class or interface in com.code_intelligence.jazzer.api" class="external-link"><code>FuzzedDataProvider</code></a>
89
+
<dd>Provides convenience methods that generate instances of commonly used Java types from the
90
+
raw fuzzer input. This is generally the best way to write fuzz tests.
91
+
<dt>any non-zero number of parameters of any type
92
+
<dd>In this case, Jazzer will rely on reflection and class path scanning to instantiate
93
+
concrete arguments. While convenient and a good way to get started, fuzz tests using this
94
+
feature will generally be less efficient than fuzz tests using any of the other possible
95
+
signatures. Due to the reliance on class path scanning, any change to the class path may
96
+
also render previous findings unreproducible.
99
97
</dl>
100
98
99
+
<p>The <ahref="FuzzTest.html" title="annotation interface in com.code_intelligence.jazzer.junit"><code>FuzzTest</code></a> annotation can also be applied to another annotations as a
100
+
meta-annotation and then applies to all methods annotated with that annotation. This can be used
101
+
to create reusable custom annotations for fuzz tests combined with other JUnit annotations such
102
+
as <ahref="https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/Timeout.html" title="class or interface in org.junit.jupiter.api" class="external-link"><code>Timeout</code></a> or <ahref="https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/Tag.html" title="class or interface in org.junit.jupiter.api" class="external-link"><code>Tag</code></a>.
103
+
101
104
<h2>Test modes</h2>
102
105
103
106
A fuzz test can be run in two modes: fuzzing and regression testing.
104
107
105
108
<h3>Fuzzing</h3>
109
+
106
110
<p>When the environment variable <code>JAZZER_FUZZ</code> is set to any non-empty value, fuzz tests
107
111
run in "fuzzing" mode. In this mode, the method annotated with <ahref="FuzzTest.html" title="annotation interface in com.code_intelligence.jazzer.junit"><code>FuzzTest</code></a> are invoked
108
112
repeatedly with inputs that Jazzer generates and mutates based on feedback obtained from
@@ -120,15 +124,16 @@ <h3>Fuzzing</h3>
120
124
will be skipped.
121
125
122
126
<h3>Regression testing</h3>
127
+
123
128
<p>By default, a fuzz test is executed as a regular JUnit <ahref="https://junit.org/junit5/docs/current/api/org.junit.jupiter.params/org/junit/jupiter/params/ParameterizedTest.html" title="class or interface in org.junit.jupiter.params" class="external-link"><code>ParameterizedTest</code></a> running on a
124
129
fixed set of inputs. It can be run together with regular unit tests and used to verify that past
125
130
findings remain fixed. In IDEs with JUnit 5 integration, it can also be used to conveniently
126
131
debug individual findings.
127
132
128
133
<p>Fuzz tests are always executed on the empty input as well as all input files contained in the
129
-
resource directory called <code><TestClassName>Inputs</code> in the current package. For example,
130
-
all fuzz tests contained in the class <code>com.example.MyFuzzTests</code> would run on all files
131
-
under <code>src/test/resources/com/example/MyFuzzTestsInputs</code>.</div>
134
+
resource directory called <code><TestClassName>Inputs</code> in the current package. For example, all
135
+
fuzz tests contained in the class <code>com.example.MyFuzzTests</code> would run on all files under
0 commit comments