开发者

Leaving a large dataset in the test database without reloading

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-lo开发者_如何学Cading it ever?


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.


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?


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜