Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Factory Boy auto generate Django model field values like Model Mommy does?

By using Model Mommy, you don't have to set every Model field you use, Model Mommy will automatically set them for you.

but in Factory Boy, if you want to use some field in the test, you have to explicitly set the value for them in ModelFactory class.

My question is: Can Factory Boy auto generate Model field values like Model Mommy does?

like image 905
GoTop Avatar asked Feb 22 '16 03:02

GoTop


1 Answers

No, Factory Boy does not currently have a way to generate values based on the attribute types defined on the database model without having to define a Factory Boy generator of some sort.

Sounds like a good feature request however.

like image 99
Oin Avatar answered Sep 28 '22 08:09

Oin