- I would like to use write to write a table and save but I'm not successful.
- I use command readfile but it always go to the workspace director even when I use absolute path, such as: C:\test.txt. So how I can pass the absolute path in readfile command?
Thank you.
Answer by PaulD · Apr 20, 2009 at 08:56 PM
When you say "write", I assume you mean "writeFile". "write" is used for populating the response to the current procedure call. "writeFile" creates or appends content to a file.
When you use a path, you should be careful about using backslashes -- because these will be substituted by default. Safer to use forward slashes. For example,
writeFile c:/test.txt $value
If you really want to use backslashes, you need to escape them:
writeFile c:\\test.txt $value
In order to be good citizen with iTest, recommended way would be to use the URI instead of direct paths. So you should use:
writeFile file://c:/test.txt $value
This will provide you with best forward compatibility as you upgrade to newer versions of iTest.
I believe the correct URI format is
file:/c:/test.txt
(One slash after the scheme rather than two.) Two slashes are used when the next segment is a server.
Copyright 2008- Spirent Communications, all rights reserved. Terms and Conditions.