Hi, I'm using Cucumber+Watir for a POC. I want to use testdata from fixtures. How can I call the data available in fixtures(.yml file) in any .rb file? Appreciate suggestions. Thx, #M
on 2013-11-04 07:23
on 2013-11-04 10:36
On Nov 4, 2013, at 12:23 AM, shaik s. <firstname.lastname@example.org> wrote: > Hi, > > I'm using Cucumber+Watir for a POC. I want to use testdata from > fixtures. How can I call the data available in fixtures(.yml file) in > any .rb file? This actually turns out to be more complicated than you might imagine. I was chatting up someone at RailsConf about this, as it was what we wanted to be able to do for our UAT regression tests (except we wanted to use factories instead of fixtures same issue applies). If youre driving your tests via Watir, you do need a way to get replicatable test data into the database to run tests consistently. You cant, however, rely on the usual suspects, and you cant really rely on a given test targets database being so clean. Even if you gave the target an initial clean target, with fixtures or factories seeded, its difficult to maintain that without some better remote control of the test target. Our thought was to come up with a Rails Engine you could slot into the test targets stack, that you could give it commands to load and clean a database set for that particular test target. Sadly, when I came back from RailsConf, management wouldnt let us build such a thing. Short of having an engine, a pair of rake tasks on the target machine to set up and tear down a database for your Watir testing could work. If youre running Watir on the same machine as the Rails app, this wouldnt be too difficult. If theyre on separate machines, youd need remote access.