Snowfakery
Snowfakery copied to clipboard
Add ability to generate permutations of list options
There are times when you need to be able to exhaustively check all use cases without having to dig out each use case from a very large data set. For generating testing data for projects like that it would be useful to be able to provide a list of fields that Snowfakery would iterate over to ensure each permutation and not just get there through random selection and data sets of sufficient size.
There are a couple approaches I could imagine:
- Augment the object count definition to provide a set of fields or value combinations as the defining target. So for the pets example in the docs it might be:
count:
permute_fields:
- species
- nemesis
- Make it a setting on fields. Forceea handles it this way. This would probably be subordinate to count and so users would have to know to make sure count was large enough to get through the options. That could look something like:
StageName:
permutation:
- Prospecting
- Qualification
- ...
- Closed Lost
- Pledged
- Add as a new option for the object itself, and list the fields to be iterated over. This could even allow a filter to help ensure only valid combinations are generated (although that could add complexity for limited value).
- object: hed__Attendance_Event__c
permutation_fields:
- hed__Attendance_Type__c
- hed__Reason__c
permutation_filters:
- hed__Attendance_Type__c: Day Tardy
hed__Reason__c: Other
fields:
hed__Arrival_Time__c:
fake: time
hed__Attendance_Type__c:
random_choice:
- Class Absence
- Class Tardy
- Day Absence
- Day Tardy
hed__Reason__c:
random_choice:
- Family
- Medical
- Other
- Religious
Nowadays we have a concept of datasets, such as CSVs.
Maybe we could make a syntax whereby you can permute N datasets (inclding "inline" datasets) to generate a new dataset.
Sorry, as part of an issue cleanup I'll have to close this until we come up with a design.