too tied • Implicit errors might happen • Factory usage involves a lot of copy/paste with small changes • A poorly designed factory might affect many tests • The tests are created in a way to fit the factory (factory-oriented testing) • Developers bump into the same issue again and again • The same hack has to be done several times
can use PollFactory(with_author=True) now • When are we going to remember to test the case PollFactory(author=None)? • We should not assume there is an author when DB actually allows to not have it.
rely on defaults from factories 3. Factories should contain only the required data 4. Build over create 5. If FK is in the table: SubFactor If FK is in the other table: RelatedFactory + trait 6. Avoid sharing factories or fixtures among different files 7. Use fixtures to wrap factories to avoid duplication Review