views:

44

answers:

3

I use cucumber to run integration tests.

I have a very large (30,000+ record) stardard setup for testing.

How can I leave that in the test.sqlite3 database without re-loading it ever?

A: 

The SQLite database is just a file. Couldn't you just copy over the desired database file (prepopulated with the data you want) prior to starting your tests?

Robert Harvey
A: 

OK, based on what you said, can you do this:

Background: Create verses 
 Given the following verses exist:
 |number|text |
 |2999  |hello|
 |2998  |hello| 
 |2997  |hello| 
 |2996  |hello| 

Scenario: A user sees only verses in their reading plan
  Given I am signed in as the Reader "Rodreegez"
  And I have reading recomendations
  When I follow "Read"
  Then I should see the following verses: 
  |number|text |
  |2999  |hello| 
  |2998  |hello| 
  And I should not see the following verses: 
  |number|text | 
  |2997  |hello| 
  |2996  |hello|

Of course, that rather involves creating the verses from a model using something like Factory Girl. Would that be possible?

Rodreegez
This app generates custom reading plans for the Bible; and to run the tests I need to, it ends up querying and searching on the verse level (30,000+ verses in Bible)
Josh Crews
Short: I'm sure that works. Long: What's going on is I'm generating reading plans that evens out how many verses per day you read; and ends up needing to know a lot about the Bible, every book and chapter and verse, to do the math
Josh Crews
+1  A: 

Cucumber will not clean out the database once the test run completes unless you put some code to do it in an After block in your env.rb file to do this.

If the data never changes then load it into the db once and assume it is there when you run cucumber. If you change some data in the db in your scenarios then make sure that you use transactional fixtures and those changes will be rolled back when the scenario finishes.

JosephL
Seems so easy. I had assumed the database is wiped out everytime.
Josh Crews
Ha! Of course this is clearly the way to do it!
Rodreegez