Test your FactoryBot knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.
Question 1/5Score 0
What is the difference between `FactoryBot.build(:user)` and `FactoryBot.create(:user)`?
Questions in this quiz
What is the difference between `FactoryBot.build(:user)` and `FactoryBot.create(:user)`?
Why might a team define multiple related factories with inheritance (e.g. `factory :admin_user, parent: :user do ... end`) rather than one large factory with many conditional branches?
How is a basic FactoryBot factory typically defined?
How does FactoryBot compare to Rails' built-in fixture files (YAML-based) as a way to generate test data?
Why might overusing factory associations (auto-creating many related objects for every single test) become a performance concern in a large test suite?
What is a benefit of using FactoryBot factories consistently across a test suite instead of manually instantiating model objects with `Model.new(...)` in every test?
What does `FactoryBot.attributes_for(:user)` return, as distinct from `build` or `create`?
Why might a test prefer `FactoryBot.build(:user)` over `FactoryBot.create(:user)` when persistence isn't actually needed?
What is FactoryBot primarily used for?
What is a FactoryBot "trait" used for?
Why is it commonly recommended to keep factory-defined default attribute values minimal/valid rather than piling on excessive complexity?