I'm trying to generate a production-quality and -quantity size test data set with Bogus, and this library works extremely well with basic data - simple datatypes like int
or string
, things like first and last name etc.
I'm currently not seeing how I can handle two scenarios in my test data setup:
-
for certain attributes of an object, I'd like to be able to define something like "in 20-30% of the cases, use a
NULL
instead of generating a value" - is this possible somehow? -
in other cases, I need to randomly pick an object from a list of available objects - but I need to use that one, picked object to set more than one attribute on my object being generated. E.g. for an "order", I might want to pick a "City" from a given list of possible cities - and once I have a city, I want to set the
CityName
,State
andZipCode
of my "order" object from that one, selected city. I haven't found a way to do this (yet) - any takers?
Aucun commentaire:
Enregistrer un commentaire