I don't want to describe the domain I work in at my work, so I will describe some fake scenario; might be silly but hopefully illustrative enough. Let's say we have a system that qualifies whether an employee deserves for promotion or not and want to test it.
The system recognizes such candidates for promotion by counting how many hours in a row a user did overtime, how many commitments it completed. It does not operates on statistics, but do calculate them themselves based on the work registered by the user.
I could set data for test in a very precise way:
createUser() .with(overtime().on(DayOfWeek.FRIDAY).from(16).to(20)) .with(overtime().on(DayOfWeek.SATURDAY).from(10).to(15)) .with(overtime().on(DayOfWeek.SUNDAY).from(14).to(19)) .with(commitment().plannedFor(days(5)).completedIn(days(1)) .with(commitment().plannedFor(days(1)).completedIn(days(3));
But I could also define a specification for the test data that is more concise
createUser() .with(overtime().of(hours(13).including(weekends())) .with(commitments().completedBeforeDeadline(0.5))
and is used by the test framework to generate actual data for the tests.
Having this kind of abstraction in the test (only a few most important variables), I am immediately able to grasp the idea of test. Also, I can write much more combinations of test in a short time.
I know we haven't invented a wheel, so I would like to read more about this approach, its risks etc but don't know how to search for it. How do you call it? Is it somehow related to BDD? Or what?