question

hemachandra09 avatar image
hemachandra09 asked hemachandra09 commented

Starting new on iTest - Requirement is to read file content with in a loop and pattern match

Single file (fileA) has list of filenames.

iTest has to loop through fileA and read each line in a loop.

-->Inside the loop iTest has to open file and pattern match and show the output.

Is this possible in iTest with out using "eval".
Sorry tried to sort this out with no luck.

Any help is much appreciated.

iTest
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mterry avatar image
mterry answered hemachandra09 commented

readfile-example.zip Here's a simple test case for reference.


1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

hemachandra09 avatar image hemachandra09 commented ·

Thank you Malcolm, much appreciated.

0 Likes 0 ·
JeffJ avatar image
JeffJ answered

If you open the file with the "readFile" command, you can set the pattern match (or not) and the contents of the file will be in the command response. If your purpose is to test each line for something, then you simply add the analysis and you should be good to go. Don't forget to make sure the analysis is set to analyze each line. One additional thought is you may want to look at using Response Filters for the readFile command. Using these, you can eliminate all unnecessary lines and only have the ones that need testing in your output to analyze.

For more information, search Help for "readFile" and "Response Filters".

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.