Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to use Selenium to test a web application but in order to do that successfully the tests must be run against a database at a known state.

The recording and running of the Selenium tests is not within the scope of this website so I'm only looking for recommendations on how best to revert the database after each test execution.

Some details:

  • current database size is 30GB however only about 4GB needs to be reverted
  • database is Oracle 11g Standard Edition running on Windows Server 2003
  • the data in 6 different schemas needs to be reverted

Ideally the process should be scripted so that it can be re-executed frequently and automatically via a scheduled task.

share|improve this question
    
should the windows tag be on this? –  Jim B Feb 17 '11 at 4:03

3 Answers 3

The easiest and quickest way to do this is to put the db on an OpenSolaris machine using ZFS and do a ZFS snapshot before starting Oracle.

Since you have already paid for a Windows Oracle licence, the best way to accomplish this is to set up a Nexenta server and use iSCSI to access ZFS as a normal Windows filesystem. The key thing to remember is not to make or restore snapshots while Oracle is running.

The snapshot and restore is almost instantaneous.

If you see the name Illumos, that is the new name OpenSolaris.

share|improve this answer

To do this programmatically you can use DBUnit (Java).

With Oracle tools, you can use SQLLDR.

share|improve this answer

I'd wrap up a shell script with expdp to export the schema and impdp to import it again. Before you run your test cases export the database, and automate your selenium tests that they execute a post-run shell script, that will execute the impdp (or imp for older Oracle) command line to get the database restored.

This is how we do it in our tests.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.