Test your FactoryBot knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.
Question 1/5Score 0
How does FactoryBot let a test override a factory's default attribute value?
Questions in this quiz
How does FactoryBot let a test override a factory's default attribute value?
How is a basic FactoryBot factory typically defined?
What does `FactoryBot.create_list(:user, 5)` do?
How does FactoryBot compare to Rails' built-in fixture files (YAML-based) as a way to generate test data?
What risk does relying on overly elaborate, deeply-nested factory setups introduce for test readability?
Why might a test prefer `FactoryBot.build(:user)` over `FactoryBot.create(:user)` when persistence isn't actually needed?
What is an "association" in a FactoryBot factory, such as `association :author, factory: :user`?
What is the difference between `FactoryBot.build(:user)` and `FactoryBot.create(:user)`?
Why is FactoryBot commonly paired with a gem like Faker for generating realistic-looking attribute values (names, emails, addresses)?
What does it mean for a factory attribute to be defined lazily (inside a block, like `created_at { Time.current }`) rather than eagerly at factory-definition time?
Why might overusing factory associations (auto-creating many related objects for every single test) become a performance concern in a large test suite?
Why is it commonly recommended to keep factory-defined default attribute values minimal/valid rather than piling on excessive complexity?