For Programmers: Free Programming Magazines  


Home > Archive > Software Testing > September 2007 > TestPartner, shared modules, and reading text files









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author TestPartner, shared modules, and reading text files
Renster

2007-09-05, 8:15 am

Folks,

I have a TP project with a number of shared modules, each of which
contains a set of functions related to a particular area of
functionality of the App Under Test. I then of course, have the main
script which calls these functions in the appropriate sequence.

While developing this code, the parameters for the functions were
declared in the function headers, and hardcoded in the calls in the
main script. However, that is of course only any use for one test run
- it had to become data driven. So I created a CSV containing rows of
varying numbers of parameters, which corresponded to the function
sequence to be called - my intention being that I could open the file
in the main script, then in each of the functions in the shared
modules add a call along the lines of "input #1,param1,param2..." etc.

However, this fails - the file is opened fine as #1 in the main
script, but referring to #1 in the input calls in the shared modules
returns a bad file name/number error.

Can anyone offer any light?

Thanks

Steve

PS... I know many people will be asking why Im not using Create Data
Test / Modify Data Table. I did look at this, and felt it would mean
the need to use too many tables, creating a maintenance nightmare. My
view is once a set of CSVs have been created, it'll be easy to just
point the main script at a different file. Also, the inability to
delete "dud" tables quickly became irritating!

Ron

2007-09-05, 7:16 pm

On Sep 5, 4:52 am, Renster <steveh...@hotmail.com> wrote:
> Folks,
>
>my intention being that I could open the file
> in the main script, then in each of the functions in the shared
> modules add a call along the lines of "input #1,param1,param2..." etc.
>
> However, this fails - the file is opened fine as #1 in the main
> script, but referring to #1 in the input calls in the shared modules
> returns a bad file name/number error.
>
> Can anyone offer any light?
>


You might try reading the CSV file into an array in the main script.
You could then access the data from the array and make your function
calls while passing the array elements.

hth

Ron

Renster

2007-09-06, 4:30 am


> You might try reading the CSV file into an array in the main script.
> You could then access the data from the array and make your function
> calls while passing the array elements.
>
> hth
>
> Ron


Hmmm, an interesting idea - could be a plan given some thought! Cheers
Ron!

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com