Forum Discussion

markre94's avatar
markre94
Occasional Contributor
3 years ago

Get script function name in Python

Hi,

I have a trouble with obtaining the name of the test function while running it as a Script Routine using Python.

 

How to retreived test function name via Project.TestItems.Current.ElementToBeRun.Caption or something else when the script is not running from ExecutionPlan as a test item but as Script Routine from the code.

  • You should just be able to assign  Project.TestItems.Current.ElementToBeRun.Caption  to a variable. What happens when you try that?

     

  • markre94's avatar
    markre94
    Occasional Contributor

    Hi Marsha_R  that works as expected but I would like to run my script directly from the Test Complete code editor and still have the same effect. I did't manage to figure it out if this is even possible.

     

    I have a defined python function that is added as a TestCase in the Execution Plan. What I want is to retireve the name of that function so the value that I should get with Project.TestItems.Current.ElementToBeRun.Caption both when running it from Execution Plan and when running it directy from code editor.