Writing variables out to a file in TruClients
I am capturing values to write out to a file so i know the data i processed and if it brought back records. I did this type of code:
var loginId = TC.getParam("p_User_ID");
var logMsg = TC.log('LastName: '+loginId);
IO.write(TC.scriptDir + "mylog.txt", +logMsg, false);
the logMsg gives me this in the log: LastName: burjuxx (which is correct)
but the IO.write statement gives me junk. is there a way to write out to a log a value captured in TruClient? I can get it to work if I put a string in place like
IO.write(TC.scriptDir + "mylog.txt", "string", false);
I'd suggest to try below code.
var loginId = TC.getParam("p_User_ID"); var logMsg = 'LastName: '+loginId; TC.log(logMsg, "Standard"); IO.write(TC.scriptDir + "mylog.txt", logMsg, false);
If you're going to be doing a lot of this I'd recommend installing the free VTS and logging data in there. Lots of file I/O worries me inside a load test.
Hi there. I have a script where I wish to do the same. Im new to Truclient so could someone show me exactly How and Where to add this type of code?
Any examples would be useful. I am presuming somewhere in the 'develop script' area in, or immediately after the step that displays the text you wish to collect and write to a file.
Thanks in advance