Get script function name in Python
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Labels:
-
Desktop Testing
-
Script Tests
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should just be able to assign Project.TestItems.Current.ElementToBeRun.Caption to a variable. What happens when you try that?
Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I understand what you're trying to do, but sometimes troubleshooting takes going back to basics to figure out what's working and what's not!
In your case, this is working as expected. ElementToBeRun only applies in the Execution Plan. What you may want to use instead is CurrentTestCase because that works in many places.
Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
