readObjectby Group Public on Wednesday November 18 2009 @ 13:37:07 (1/1 Points) |
|
| API ↪Reference ✑ Reply ✓ Stick It ✗ Ditch It ⚐ Tag It |
readObject reads an object form the file system previously saved with StoreObject→.
set %Data% as readObject filename
Filename
The filename should end in .stest as it is the only supported type at the moment. It is produced by the StoreObject→ function.
The filename will be subject to normal path resolution or you can specify an absolute filename.
Sample
This very basic example updates a counter every time it is run. Normally the StoreDir item would be specified in a separate configuration file.
set %StoreDir% /tmp/
# Look for an load the existing file
set %File% %StoreDir%/MyData.stest
if fileExists %File%
set %Data% as readObject %File%
else
set %Data% with
%Count% 0
end
end
# Do something
# ...
# increment our count
set %Data:Count% as binOp %Data:Count% + 1
set %Data:LastRun% %Var:DateTime%
# Save our changes
StoreObject %Data% %File%
TestPlan readObject
