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

Execution result from test as step is it possible?

3 Answers 85 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 10 Mar 2014, 11:56 AM
Hi Guys

I was wondering if anyone could help. I am attempting to create a test which uses an If else statement following the â€‹Pseudocode below

if(Test as Step executing has passed)
       Log that the Test as Step has passed (i.e. so that the tester knows the pre-conditions have been met) 
       Continue with this test case
Else
       Log an error or fail and stop the test stating that this has failed.


Is it possible to get the results from a test case that you are using as a 'test as Step'?

Thanks

Chris

3 Answers, 1 is accepted

Sort by
0
Shashi
Top achievements
Rank 1
answered on 11 Mar 2014, 12:30 PM
Christopher,

Short answer to your question is yes - but the other question you should ask yourself is:  do you really need to?

You have 2 options to implement what you want (as I understand it):

a) If you do not need to perform any actions further down in the test based on the pass/fail status of the shared test (the test you are calling in the Test as step), you do not need the IF/ELSE statement - simply call the shared test.  If shared test fails, main test will also fail. 
NOTES:
a) Log file will give you cause of error.  
b) You can add additional logging in appropriate steps of the shared test if needed - either using the LogMessageOnFailure property of each step or using Log.WriteLine in a coded step.

b) If you do need to use the result of the Test as step further down in the test for any reason (and you can't simply call the shared test again), have the shared test populate an extracted variable (using SetExtractedVariable in a coded step) - and then retrieve the variable in the main test (using GetExtractedVariable).
NOTES:
a) AFAIK, Test Studio does not support checking the value of an extracted variable inside a recorded IF statement - you will need to use a coded step to perform this check. Further, if you use a coded step to implement the IF statement, all statements inside the IF statement must also be coded (even if they could otherwise be recorded).
b) I would suggest using a meaningful extracted variable name and document it in comments at the top of the test (so others who may work with this test - or you yourself if you work on it after a long break - are aware of its existence.

Hope that helps,
Shashi 
0
Boyan Boev
Telerik team
answered on 13 Mar 2014, 09:35 AM
Hi,

@Shashi, thank you helping others. We really appreciate it.

@Christopher, let us know if you need additional information about this scenario. Shashi described it very well.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Christopher
Top achievements
Rank 1
answered on 13 Mar 2014, 10:01 AM
Hi Guys

Thanks for all the information

Chris
Tags
General Discussions
Asked by
Christopher
Top achievements
Rank 1
Answers by
Shashi
Top achievements
Rank 1
Boyan Boev
Telerik team
Christopher
Top achievements
Rank 1
Share this question
or