[Wtr-general] Using Data from CSV or XLS
Daniel Browne
browne.daniel at gmail.com
Tue Apr 11 17:41:59 EDT 2006
and:
http://fit.c2.com/wiki.cgi?RubyPlatform
On 11/04/06, Daniel Browne <browne.daniel at gmail.com> wrote:
> See also:
>
> http://fitnesse.org/FitServers.RubyFit
>
> Note I have never used it though.
>
> Cheers,
> Daniel.
>
> On 11/04/06, Sean Gallagher <Sean.Gallagher at ticketmaster.com> wrote:
> > Here is some code that I am experimenting with for filling in forms using
> > YAML. The data in MyDataFile.yml drives which fields, select lists, etc. are
> > set and the values for each. The names used in MyDataFile.yml are the
> > element ids. Different data comes from using different data files.
> >
> > Comments are appreciated! :-)
> >
> > -------------------------------------------------
> > Example.rb
> > -------------------------------------------------
> > datafile = 'MyDataFile.yml'
> > testdata = YAML.load(File.open(datafile))
> >
> > page = 'MyPageReference' # Reference for page and data
> >
> > $ie.div(:id, page).click # I click a div for my page
> >
> > tfields = testdata[page]['text_fields']
> > tfields.each do |tf|
> > $ie.text_field(:id, tf[0]).set(tf[1])
> > end
> >
> > slists = testdata[page]['select_lists']
> > slists.each do |sl|
> > $ie.select_list(:id, sl[0]).select(sl[1])
> > end
> >
> > -------------------------------------------------
> > MyDataFile.yml
> > -------------------------------------------------
> > MyPageReference:
> > text_fields:
> > name: John Doe # 'name' is the text field id
> > city: Los Angeles
> > state: CA
> > select_lists:
> > enabled: 'Y'
> > display: 'OFF'
> >
> > ... etc.
> >
> > -------------------------------------------------
> >
> > Sean
> >
> > --
> > http://testmethods.net/
> >
> >
> > _______________________________________________
> > Wtr-general mailing list
> > Wtr-general at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/wtr-general
> >
>
More information about the Wtr-general
mailing list