Skip to content

CodeIntelligenceTesting/example-bazel-junit

Repository files navigation

Pure Jazzer JUnit with Bazel

Example project for showcasing how to use Jazzer in a Bazel JUnit5 project.

The original JUnit example is taken from https://github.com/junit-team/junit-examples/tree/main/junit-jupiter-starter-bazel

Fuzzing

To fuzz the functions annotated by @FuzzTest, use bazel run command. bazel run will presist all corpus entries that discover new edges in .cifuzz-corpus/<pkg>.<class>/<method > and any findings in resources/<pkg path>/<class>/<method> directory. To select which fuzz test to run use --test_filter flag.

This will fuzz the function fuzzAdd:

JAZZER_FUZZ=1 bazel run :junit-jupiter-starter-bazel-tests --test_filter="fuzzAdd"

And this command will fuzz the function fuzzDivide:

JAZZER_FUZZ=1 bazel run :junit-jupiter-starter-bazel-tests --test_filter="fuzzDivide"

Regression

Jazzer fuzz tests run by default in regression mode alongside JUnit tests. Just issue a bazel test command:

bazel test :junit-jupiter-starter-bazel-tests

About

Example project showcasing how to use Jazzer in a bazel JUnit5 project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published