| || |
Functionize some code...
I have the following code:
Can somebody help me put this code in a function? or a script?
The problem: I do not want to add all the code in EVERY test case, but I need at least to call it from every script. I want to functionize <-- (New word) it.
The 2nd problem: The td code gets the current test case... So somehow we need to get the testcase which is calling the function's name?! Another problem...
I've always had problems making functions (compiled modules) that had dependant variables. Can anybody suggest a way to do this?
Re: Functionize some code...
AJ, I'm not sure if I understand precisely what you're after here. However, Issue 2 might be addressed by the following code snippet, which whill tell you what script/function called the current function:
"caller" will now equal the name of the calling script/function, and as a bonus I've given you the line number (lineNbr) which made the call, if you care. Hope that helps a little.
Charles Reace (charlesDOTreaceATverizonDOTnet)
"Forward!" he cried from the rear, and the front ranks died.
The generals sat, and the lines on the map moved from side to side.
(Roger Waters, "Us and Them")
[i]...Sound trumpets! Every trumpet in the host! / Sixty thousand, on these words, sound, so high the mountains sound, and the valleys resound.</i] (The Song of Roland)