Forum Discussion
tristaanogre
14 years agoEsteemed Contributor
ACTUALLY... if you're using JScript, you can use the technique discussed in the following article:
http://blog.smartbear.com/post/11-02-16/improving-traceability-in-testcomplete-logs/
Every function you create, then, add in the code as the first line of the function
You then make sure you have a project variable set as a string type with the default value set to
http://blog.smartbear.com/post/11-02-16/improving-traceability-in-testcomplete-logs/
Every function you create, then, add in the code as the first line of the function
eval(Project.Variables.functionEnter)
You then make sure you have a project variable set as a string type with the default value set to
var functionName = eval ('arguments.callee.toString()');var parameters = eval ('arguments.callee.toString()');
var message = '';
functionName = functionName.substr('function '.length);
functionName = functionName.substr(0, functionName.indexOf('('));
parameters = parameters.substr (parameters.indexOf ('(') + 1);
parameters = parameters.substr (0, parameters.indexOf (')'));
parameters = parameters.replace (/\r\n|\n/gm, ' ');
parameters = parameters.split(/,\s?/);
for (var i = 0; i < parameters.length; i++)
{
message += 'Parameter [' + parameters + '] : ';
message += typeof arguments + '\n';
if (arguments === undefined)
{
message += '\n';
}
else if (typeof arguments === "string")
{
message += '\t"' + arguments + '"\n\n';
}
else
{
message += '\t' + arguments + '\n\n';
}
}
Log.Message ('Entering ' + functionName, message);
This works like a charm and I've started using this extensively in my own code work.
Related Content
- 2 years ago
- 4 years ago
Recent Discussions
- 17 hours ago
- 17 hours ago
- 4 days ago