Forum Discussion
arguments.callee.caller
I will further investigate this approach, but last time I ran it, it got one of the subfunctions names (eg Close dialogue, which is called multiple times and is not the parent script run)
aqTestCase.Begin("Name 1");
Log.Message(aqTestCase.CurrentTestCase.Name)
aqTestCase.End();
- Lee_M3 years agoCommunity Hero
Thanks,
This has a limitation, this would only work if your case was in a test case using the EP and will not work for simple tests (or testing when building the tests)
If you call the name of a case then I have found it needs to be hardcoded, you can't ready the initiator of the current test
e.g.
- order_book_test
(test sections)
1, login
1.1, navigate - (say which function test is going to this page, ref will get login and not order_book_test)
2, order book "testing"
3, logout
- AGubarev3 years agoSmartBear Alumni (Retired)
>this would only work if your case was in a test case using the EP
what does "EP" mean?
>you can't ready the initiator of the current test
Sorry, didn't catch the idea.
So, you have an example:
The test case name : order_book_test Steps: 1. Login 1.1. Navigate 1.2. Pass auth 2. Make order 3. Logout
Do you want something like this?
function main() { let scenarios = ["order_book_test", "order_glass_test"] for (var i=0; i<scenarios.length; i++) { aqTestCase.Begin(scenarios[i]); Login(); Make_Order(scenarios[i].split("_")[1]); Logout(); aqTestCase.End(); } } function Login() { Log.AppendFolder(arguments.callee.name); Log.Message("Navigate"); Log.Message("Pass auth"); Log.PopLogFolder(); } function Make_Order(goods) { Log.AppendFolder(arguments.callee.name + ": " + goods); Log.Message("Make order") Log.PopLogFolder(); } function Logout() { Log.AppendFolder(arguments.callee.name); Log.Message("Logout") Log.PopLogFolder(); }
- Lee_M3 years agoCommunity Hero
The case above is calling the test name from an array, whichever function outputs this name, it will always be correct.
I mean call the test name from a function that is not a direct descent of the parent
EP - Execution Plan
Related Content
- 10 months ago
- 8 months ago
- 12 months ago
- 15 years ago
- 12 years ago