Forum: Ruby Data from Fixtures

462c96e85144024df16705e088c0d638?d=identicon&s=25 shaik s. (shaik_s)
on 2013-11-04 07:23
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
Aa082c8b00a50928e5860dcd70bf2368?d=identicon&s=25 tamouse m. (tamouse_m)
on 2013-11-04 10:36
(Received via mailing list)
On Nov 4, 2013, at 12:23 AM, shaik s. <lists@ruby-forum.com> 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.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.