- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Read lines from a txt file (variable number of lines)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-16-2010 02:39 AM
Hi everybody
I am helping a customer to evaluate iTest, and they asked me a question, and really.. I don't know how to solve it.. :-(
the would like to have a list of parameters in a txt file, so the script can read the lines and execute the tests several times, each one with different values.
So I need to access to a textfile, read a line, use the parameters to run the tests, read second line, use it to run again the test with new values... and so on, but the numbers of lines are not fixed, so I cannot assign variables in static way...and that is the only way I found through readFile command..
Anyone could help me?
Thanks!!!
Re: Read lines from a txt file (variable number of lines)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-16-2010 07:03 AM
You can use readFile read the whole file's content and store it to a variable (say "my_params"), then in the analysis rule of the action use [query $my_params line()] to get content of each line. You will need to create a corresponding response map for the readFile action. You can then wrap this with a "foreach" loop to run procedures on each of the parameters. Please refer to these posts for more details:
Re: Read lines from a txt file (variable number of lines)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-16-2010 07:44 AM
Thanks a lot!!! it is clear now :-)
Re: Read lines from a txt file (variable number of lines)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-16-2010 07:53 AM
Note that if you are willing to use a simple XML file format rather than a text file format, then it is even easier, because when you call readFile on that XML file, it will already be structured with queries to fetch all of the information you want from it. Either way works, though.
