Printer FriendlyEmail Article Link

iTest:Using iTest how to edit content in .csv file

Environment/Versions

Spirent iTest

Answer

We can edit the content in the .csv file by using File session profile.

Here are the steps to achieve this:

1. Open the Input CSV file(File session profile)

2. Read the header from the original CSV (Using read command)

3. Open the temporary file and write the header (Another File session profile)

4. Foreach record in the CSV input file, read the next line for testing (read line by line

5. Based on the “linecount” edit the content in the file by using “regsub” function

6. Write the results to the temporary file

7. Overwrite input CSV file with the temporary CSV file.

Attaching sample test case for reference.

 

Attachments
Attachment


Product : iTest Enterprise