[Wtr-general] Data driven tests

Balakrishna balakrishna.venkatappa at ionidea.com
Mon Jan 8 03:24:25 EST 2007


Hi all,

 

I'm stuck with a weird problem. Basically I'm trying to do a data driven
test. I am reading data from access db. The problem I'm having is I'm
reading a recordset, then I would like to read each row from the recordset
and perform some actions and then read the next row from recordset and
perform the actions again. It's like doing the same operation without
different data sets. The code I've end up till now is as follows.

 

$dbcounter = 1

$tempcounter = 1 

require 'odbc'

include ODBC

drv = Driver.new

drv.name = 'Driver1'

drv.attrs['driver'] = 'Microsoft Access Driver (*.mdb)'

drv.attrs['dbq'] = 'C:\dl_alpha.mdb'

dbh = Database.new.drvconnect(drv)

sth = dbh.run("Select * from tbl_dl")

#sth.each do |row|

while row = sth.fetch do

                $var_TNOrder = row[0]   

                $var_LEC = row[1]

                $var_TN = row[2]

                $tempcounter = $tempcounter + 1

 

printf "Entered while loop, TNORder: %s",$var_TNOrder

 

end

 

 

the problem I'm having here that I'm not able to assign the data value from
recordset to my local variables.  The while loop executes only after End
command. Until end command is reached it does not set any variables.  Please
can you guide me on this. I am sure  there should be a way out.. I am new to
ruby. 

 

Thanks 

Balu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070108/92e931c9/attachment-0001.html 


More information about the Wtr-general mailing list