TestDataAutoGen 1.0.1
dotnet add package TestDataAutoGen --version 1.0.1
NuGet\Install-Package TestDataAutoGen -Version 1.0.1
<PackageReference Include="TestDataAutoGen" Version="1.0.1" />
<PackageVersion Include="TestDataAutoGen" Version="1.0.1" />
<PackageReference Include="TestDataAutoGen" />
paket add TestDataAutoGen --version 1.0.1
#r "nuget: TestDataAutoGen, 1.0.1"
#:package TestDataAutoGen@1.0.1
#addin nuget:?package=TestDataAutoGen&version=1.0.1
#tool nuget:?package=TestDataAutoGen&version=1.0.1
TestDataGenerator
A flexible C# library for automatic generation of randomized test data with rich customization via attributes. Simplifies creating complex test objects, including nested classes and collections.
Features
- Attribute-driven configuration of generated data values.
- Supports primitive types:
int,long,double,float,decimal,bool,string,DateTime,Guid. - Supports
Nullabletypes and enums. - Generates collections:
List<T>, arrays, and dictionaries (Dictionary<TKey, TValue>). - Handles nested complex objects recursively with configurable depth.
- Supports null values with configurable probability.
- Customizable ranges, string formats, fixed value lists, and collection sizes.
- Default values provided when attributes are not specified.
Installation
Use the NuGet package manager:
Install-Package TestDataGenerator
Or via .NET CLI:
dotnet add package TestDataGenerator
(Note: Package publishing pending - coming soon)
Usage
1. Define your class with FakeDataAttribute on properties
public class Person
{
[FakeData(MinInt = 18, MaxInt = 99)]
public int Age { get; set; }
[FakeData(StringLength = 12)]
public string Name { get; set; }
[FakeData(MinCollectionCount = 2, MaxCollectionCount = 5)]
public List<int> Scores { get; set; }
public Address HomeAddress { get; set; }
}
public class Address
{
[FakeData(StringLength = 20)]
public string Street { get; set; }
public string City { get; set; }
}
2. Generate test data
var person = TestDataGenerator.Generate<Person>();
3. Customize as needed
You can specify ranges, fixed values, string formats, null probabilities, and collection sizes:
[FakeData(MinDouble = 1.5, MaxDouble = 10.5, NullProbability = 0.1)]
public double? Score { get; set; }
[FakeData(FixedValues = new[] { "Red", "Green", "Blue" })]
public string FavoriteColor { get; set; }
Supported Attribute Properties
| Property | Description | Type | Default |
|---|---|---|---|
MinInt, MaxInt |
Range for integers | int |
0, 100 |
MinLong, MaxLong |
Range for long integers | long |
0, 1000 |
MinDouble, MaxDouble |
Range for doubles | double |
0.0, 100.0 |
MinFloat, MaxFloat |
Range for floats | float |
0f, 100f |
MinDecimal, MaxDecimal |
Range for decimals | decimal |
0m, 100m |
StringLength |
Length of generated strings | int |
10 |
StringFormat |
Format or pattern for strings (optional) | string |
null |
MinDate, MaxDate |
Date range for DateTime properties | string (date parsable) |
null |
FixedValues |
Fixed set of possible string/enum values | string[] |
null |
MinCollectionCount, MaxCollectionCount |
Size range for collections | int |
1, 3 |
NullProbability |
Probability of null value assignment (0.0 - 1.0) | double |
0.0 |
Limitations and Notes
- Maximum recursion depth for nested objects is limited to prevent stack overflow (default: 3).
- String format support is basic; custom implementations can extend it.
- Currently supports only generic collections like
List<T>, arrays, and dictionaries. - Nullability applies only to reference and nullable value types.
- Designed primarily for unit testing and development mock data generation.
Contributing
Contributions and suggestions are welcome! Please open issues or submit pull requests.
License
MIT License. See LICENSE file for details.
Contact
For questions or feedback, please reach out.
🎉 Pro Version Now Available!
Looking for more advanced features like schema-based generation, faker rules, and bulk data creation?
👉 Explore the Pro Version & Full Feature Comparison
🚀 Introducing TestDataAutoGen Pro!
Supercharge your test data generation with TestDataAutoGen Pro:
✅ JSON & XML schema-based generation
✅ Rule engine with custom property handling (e.g., emails, UUIDs)
✅ High-performance bulk generation
✅ More control, more flexibility
🔐 Pro is a private package available via GitHub NuGet feed.
📦 Learn more and request access: See Pro Version 📧 Contact: kumuddeveloper@gmail.com
This project is in active development. Stay tuned for upcoming releases and features!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.