2017 up to now  | 2016 | 2015 | 2014 | 2013 | 2012 | 2011 | 2010 | 2009 | 2008 | 2007

(older archive entries before 2007 are not shown here, but included in the onsite-search)

Mailing List - Entries of 2011


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] Selecting rows from a data driver node


  • Subject: Re: [QF-Test] Selecting rows from a data driver node
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: Mon, 21 Nov 2011 21:12:15 +0100

Hi Chris,

there's a relatively new attribute for data nodes called 'Iteration
ranges'. You can use is it to define a subset of the data in a syntax
similar to the one used for defining the pages to print in a typical
print dialog. See

http://www.qfs.de/qftest/manual/en/datadriver.html#step_CSVDataBinder

for detailed information.

If you calculate the random numbers in the data driver before the 'CSV
data' node you can use them to specify a single entry or a sub-range.

Best regards,
    Greg

<Christopher.Stanbridge@?.au> writes:

> Hi List,
>
> I've got a large csv (100K lines) with key pair values I'd like to check. I've created a data driver that uses this csv and I'd like to select n random rows from this file in a loop as a spot check.
>
> Currently I have:
>
> DataDriver: csvfile
>   -> Get Rowcount  [ Rowcount = sum(1 for line in open(rc.lookup('csvfile'))) ]
>   -> Set variable TotalNumberOfTestsToRun
>         -> Loop $(TotalNumberOfTestsToRun)
>               -> qfs.utils.random.getNumberFromRange (lowest = 1, highest = $(Rowcount))
>               -> RunTest
> Break
>
> The results is that I always get the first row in my file executed. Is there a way to select n random rows from the file?
>
> Thanks in advance,
>
> Chris

-- 
Gregor Schmid                                Gregor.Schmid@?.de
Quality First Software GmbH                     http://www.qfs.de
Tulpenstr. 41                               Tel: +49 8171 38648-0
DE-82538 Geretsried                         Fax: +49 8171 3864816
GF: Gregor Schmid, Karlheinz Kellerer          HRB München 140833