Skip to main content
Version: 11.x

Logging for Object Resolution

AutoParams provides detailed logging capabilities that help you understand how objects are being resolved during test execution. To enable logging, apply the @LogResolution annotation to your test method alongside @AutoParams. When enabled, the resolution log is printed to standard output during test execution, making it easy to trace how each value is generated.


For example, resolving a User class produces a detailed trace. Given the following class:

@AllArgsConstructor
@Getter
public class User {

private final UUID id;
private final String email;
private final String username;
}

Running the following code:

@Test
@AutoParams
@LogResolution
void testMethod(User user) {
}

Will print a hierarchical visualization of the resolution process:

User user (5ms)
├─ UUID id → fbdf7aa8-1af7-4308-bc64-ee9dbfeba8d2 (1ms)
├─ String email → 53bf56a3-8a42-47f3-a5c9-854862ea4a56@test.com (2ms)
└─ String username → usernamec6962921-ab77-4dbc-a71d-6932a9faa5be (1ms)

The log uses a tree structure to show the resolution hierarchy:

  • Each level shows the query type and parameter name
  • indicates the generated value
  • Time taken for each resolution is shown in parentheses
  • Indentation levels represent the depth of the resolution chain

This logging is particularly valuable when working with:

  • Customizations
  • Complex object hierarchies
  • Dependency injection scenarios
  • Debugging test failures related to object generation