Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I use Ruby with Selenium to do test automation on a web application that has a MySQL DB behind it. I need a good way to load data into the DB from a Ruby script. So far in my research I have found using an export of the DB tables in CSV files and then loading the files back into the DB before running a test that requires the data. To connect to the DB I have found the gems mysql2 and net/ssh/gateway.

Does this approach make sense or is there a better way?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

That sounds basically right. The only change I might make is instead of loading up to a CSV, you can just take a mysqldump and load the DB from the dump at the beginning of the script.

share|improve this answer
    
What's the advantage of your approach in comparison to the approach in question? –  dzieciou Nov 15 '12 at 7:45
    
As far as the machine is concerned, I don't think much. That's the reason I used 'might'. I think this is a good thread to read some opinions - stackoverflow.com/questions/467452/… –  Suchit Parikh Nov 15 '12 at 18:10
    
Actually just remembered the reason I wrote that - in a case where you want to start with a clean database, you can have a script delete all tables from the DB and then use the mysqldump to create the schema and insert the data. –  Suchit Parikh Nov 15 '12 at 18:35

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.