title: Mocking a database for system testing
body: <p>I've read the following posts:</p>
  
  <p><a href="https://stackoverflow.com/questions/6734410/is-there-a-way-to-run-mysql-in-memory-for-junit-test-cases">Is there a way to run MySQL in-memory for JUnit test cases?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/5550128/stubbing-mocking-a-database-in-net">Stubbing / mocking a database in .Net</a></p>
  
  <p><a href="https://stackoverflow.com/questions/4989975/sql-server-stub-for-java">SQL server stub for java</a></p>
  
  <p>They seem to address unit/component level testing (or have <a href="https://stackoverflow.com/questions/33645011/mocking-web-services-for-system-testing">no answers</a>), but I'm doing system testing of an application which has few test hooks. I have a RESTful web service backed by a database with JPA. I'm using NUnit to run tests against the API, but those tests often need complex data setup and teardown. To reduce the cost of doing this within a test via API calls, I would like to create (ideally in memory) databases which can be connected to via a DB provider using a connection string. The idea would be to have a test resource management service which builds databases of specific types, allowing a test to re-point the SUT to a new database with the expected data when it starts - one which can simply be dropped on teardown.</p>
  
  <p>Is there a way, using Oracle or MSSQL, to create a database in memory (could be something as simple as a C# DataSet) which the web server can talk to as if it were a production database? Quick/cheap creation and disposal would be as good as in memory, to be honest.</p>
  
  <p>I feel like this is a question that should have an answer already, but can't find it/ don't understand enough to know that I've found it.</p>