Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8499855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:46:51+00:00 2026-06-11T00:46:51+00:00

I am writing integration tests for a Rails application using Watir and RSpec. What

  • 0

I am writing integration tests for a Rails application using Watir and RSpec. What is the best way to set up data in the database that spans each test? For instance, I have the same user I want to use across a suite of tests. How can I seed that common data (e.g. user) before all the tests run and then clean it up for the next suite of tests?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:46:52+00:00Added an answer on June 11, 2026 at 12:46 am

    Generally having some global data for tests is a bad idea and might introduce dependencies within tests (which is always a bad idea). To avoid that, each test should generate the data it needs for itself and not rely on some globally inserted data.

    If you’re using RSpec then it does some of the job for you (it even runs your tests in a random order to avoid dependencies) – it creates a database savepoint before running the test and rollbacks all the changes done by the test. Ideally this means that test database is empty before test runs and it will be empty after test has been run.

    In Rails you could use Rails own fixtures to seed the needed data or use some third party gem like FactoryGirl.

    Again, do not create any global data, which will be used by all tests because sooner or later this will come back to haunt you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an integration test for a rails application using Capybara within Rspec. After
I'm writing an integration test for a rails application using webrat. After filling out
I'm writing an integration tests for my database, and I've got one question. At
We have an old asp.net application that has no unit tests, integration tests, component
I'm writing unit tests (technically integration tests since I am connecting to a database)
I'm writing some integration tests using a robot. I have the robot opening a
We're in the process of writing Integration Tests for Java EE application and can't
We use an Oracle(or postgres) database and an application server to execute integration tests.
I'm writing Integration tests for a webapp using Spring AbstractJUnit tests and Hibernate for
I'm writing integration tests using JUnit to automate the testing of a console based

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.