https://github.com/creoone/fuzzer
Helping hand in testing.
https://github.com/creoone/fuzzer
csharp dotnet fuzzing testing
Last synced: about 2 months ago
JSON representation
Helping hand in testing.
- Host: GitHub
- URL: https://github.com/creoone/fuzzer
- Owner: CreoOne
- Created: 2018-12-10T19:07:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-19T19:08:47.000Z (over 7 years ago)
- Last Synced: 2025-06-21T01:41:16.498Z (12 months ago)
- Topics: csharp, dotnet, fuzzing, testing
- Language: C#
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fuzzer
Helping hand in testing.
## Description
Fuzzer is a simple cases generator for unit tests. It brute-forces trough all possible combinations of provided values. It works with frequent values like `0` or `1` but can also do fuzzing with `NaN` and random strings that are megabytes in size.
## Roadmap
For current roadmap go to [General Project](./../../projects/1)
## Usage
```cs
Scenario scenario = new Scenario()
.NonRandom()
.Random(amount: 10)
.RandomString(amount: 10, encoding: Encoding.UTF8)
.RandomDateTime(amount: 10, kind: DateTimeKind.Utc)
.Except(1UL)
.Except(default(DateTime))
.Except(default(Guid));
IEnumerable results = new CasesGenerator(scenario);
```
### with NUnit
like in [SampleFixture.cs](./FuzzerTests/SampleFixture.cs)
```cs
[TestFixture]
public class SampleFixture
{
[Test]
[TestCaseSource("SampleTestGenerator")]
public void SampleTest(string name, double lattitude, double longitude, DateTime when)
{
// Your assertions go here
Assert.True(true);
}
public static IEnumerable SampleTestGenerator()
{
Scenario scenario = new Scenario()
.NonRandom()
.Random(amount: 10);
return new CasesGenerator(scenario)
.Select(c => new TestCaseData(c));
}
}
```
## Fuzz providers
- List of all currently available values used for fuzzing can be found in [Scenario.cs](./Fuzzer/Scenario.cs)
- You can write Your own provider:
- by implementing `Fuzzer.Fuzzers.IFuzzer<>` like in [CustomFuzzerFixture.cs](./FuzzerTests/CustomFuzzerFixture.cs)
- by making incubator `Func<>` like in [IncubatorFuzzerFixture.cs](./FuzzerTests/IncubatorFuzzerFixture.cs)
- by providing literal like:
```cs
scenario.Add(ConstantFuzzer.Create( /* literal in here */ ));
```
- types that don't have added provider will be tested as `default()`