This is a migrated thread and some comments may be shown as answers.

How Do I Get The Name of The Test Executing Another Test as a Step?

1 Answer 55 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 16 Mar 2017, 04:54 PM

Hello,

I am trying to print out the name of the test executing another test as a test as step and was wondering if this can be done? For example lets say i have two tests "A" and "B". They are both Wpf tests and "B" just contains a coded step. Test "A" has a step where it executes "B" as a Test As Step. Is it possible to get the name of Test "A" through the code?

 

The closest thing I've found was this 

http://www.telerik.com/forums/how-to-get-the-test-name-which-i-am-executing-during-run-time

but would only get me the name of "B".

 

Thanks,

1 Answer, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 21 Mar 2017, 01:24 PM
Hello Adam,

Thank you for your research before posting a query to our forum. 

As far as I understand you would like to have the parent test name while executing a test as step. In runtime you could get only the name of the currently executed test as described in the forum post you refer to. 

However you could accomplish your requirement using a non straight forward approach. In the parent step you could add a coded step extracting the name of the parent test into a variable. Here is how you could get and set variables in code. 

The child test should inherit the parent data and the extracted variable in the parent test could be used in the test as step. 

I hope this will be useful for you as well! 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Adam
Top achievements
Rank 1
Answers by
Elena
Telerik team
Share this question
or