English 中文(简体)
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-loading 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?





相关问题
Selenium not working with Firefox 3.x on linux

I am using selenium-server , selenium rc for UI testing in my application . My dev box is Windows with FireFox 3.5 and every thing is running fine and cool. But when i try to run selenium tests on my ...

Best browser for testing under Safari Mobile on Linux?

I have an iPhone web app I m producing on a Linux machine. What s the best browser I can use to most closely mimic the feature-limited version of Safari present on the iPhone? (It s a "slimmed down" ...

Code Coverage Tools & Visual Studio 2008 Pro

Just wondering what people are using for code coverage tools when using MS Visual Studio 2008 Pro. We are using the built-in MS test project and unit testing tool (the one that come pre-installed ...

Is there any error checking web app cralwers out there?

Wondering if there was some sort of crawler we could use to test and re-test everything when changes are made to the web app so we know some new change didn t error out any existing pages. Or maybe a ...

热门标签