factory_bot
Metrics as of , from the GitHub or GitLab API of each repository. Refreshed monthly.
What factory_bot is
factory_bot is a Ruby library that replaces fixtures with factory definitions for building test objects. Its build strategies return persisted objects, unsaved objects, stubbed objects or plain attribute hashes. One class can have several factories, such as user and admin_user. Factories can inherit from other factories. Rails projects use the separate factory_bot_rails gem. Integrations with RSpec, Rails and other libraries are covered in the project wiki. The gem is added to a project with Bundler or installed with the gem command.
Written from the project's README, read .
- Category
- Test data and mocking
- License
- MIT
- Language
- Ruby
- Changelog
- Releases on GitHub
Repository metrics
Status
activeLast commit within 90 days of the fetch date.Computed from the last commit date and the archive flag on the fetch date. See the status rules.
Alternatives
Listed test data and mocking tools, same primary language first, then by GitHub stars. Each line gives one fact from the tool's documentation where it differs from factory_bot's, with its source.
JSON Server: Definition format: JSON or JSON5 data file (db.json or db.json5). source: README
Faker: Languages for writing tests: Python (3.8 and above). source: README
Mock Service Worker: Languages for writing tests: JavaScript. source: README
@faker-js/faker: Languages for writing tests: JavaScript (browser and Node.js). source: Docs: Getting Started
Mockito: Languages for writing tests: Java. source: README
Nock: Languages for writing tests: Node.js. source: README
Sinon.JS: Languages for writing tests: JavaScript. source: Docs: SinonJS home
Bogus: Languages for writing tests: C#, F#, VB.NET. source: README
How to install
bundle add factory_botQuestions
Is factory_bot open source?
Yes. factory_bot is released under MIT, an OSI-approved license, as reported by the GitHub API on 2026-09-22.
Is factory_bot maintained?
On 2026-09-22, the last commit to the default branch was on 2026-08-21, so the listed status is active. Rule: Last commit within 90 days of the fetch date.
How many GitHub stars does factory_bot have?
8,169 stars on 2026-09-22, from the GitHub API. The number is refreshed at each monthly update.
What language is factory_bot written in?
The repository's primary language, as reported by the GitHub API, is Ruby.
How do I install factory_bot?
The README gives this command: bundle add factory_bot
Sources
- GitHub REST API: repository, read
- GitHub REST API: commits, read
- GitHub REST API: latest release, read
- GitHub REST API: contributors, read
- README, read