Features
AutoParams provides a set of features designed to make your tests more expressive and reduce repetitive setup. Here are some of its key capabilities:
📄️ @FreezeBy Annotation
The @FreezeBy annotation enables fine-grained control over value freezing in tests. It allows you to freeze a single value and reuse it across multiple generation targets that match specific conditions, such as type or name. This helps improve test readability and ensures consistency among generated values.
📄️ Setting the Range of Values
You can constrain the range of automatically generated values using the @Min and @Max annotations. These let you define minimum and maximum bounds for numeric parameters, ensuring that generated values fall within a specified range.
📄️ ResolutionContext class
The ResolutionContext class provides the core mechanism for generating test data. While it is used internally by AutoParams, you can also instantiate and use it directly in your own test code when needed.
📄️ Factory<T> class
The Factory class is useful when you need to generate multiple instances of the same type. It allows you to create single instances or collections of generated objects on demand.
📄️ Customization
Customization is one of the most powerful features offered by AutoParams. It gives you full control over how test data is generated, allowing you to enforce business rules or tailor the data to meet specific testing needs.
📄️ Parameterized Tests
AutoParams also supports parameterized tests, allowing you to execute the same test logic with multiple sets of input data. With AutoParams, you can seamlessly combine manually specified values with automatically generated test data—enabling both flexibility and convenience.
📄️ Constructor Selection Policy
When AutoParams generates instances of complex types that have multiple constructors, it follows a specific policy to determine which constructor to use: