How to stop a test case with several work flows and transfer the result to the Then part

I have a test case that has several work flows in the “When” part.
I want to understand how I can know if a certain work flow has failed and if so, pass it through out_message to the part of the “Then” where I transfer the results of the run to Excel.
In other words, I’m trying to go to the “When” part straight away from the work flow who failed Without continuing to the works flow that remained in the “When” section. Is there a way to do this?

@mironb

Try using a try catch in hwrn part and keep all inside try

Cheers

@Anil_G
What is “hwrn” ?

@mironb

I meant in the when part…its a type :slight_smile:

Cheers

@Anil_G
Haaa :slight_smile:
I have in the When some WFs I need in each of them where I think there could be a failure to put verify control attribute and in it check app state and then if there is a failure put a throw that will stops the specified WF and not continue to the other WF’s in the WHEN (when we put the try/catch) ?

@mironb

ideally it would not continue…it would fail

cheers

@Anil_G
Yes, that’s what I meant, the problem is that I pass out arguments in every WF and I noticed that if it falls in THROW, the arguments do not move to the central part where the TRY.CATCH is located
Is there a way to overcome this and pass the argument? For example, I want to write in ASSIGN
out_message = “Its falls because …”

@mironb

then inside each xaml surround all your activities with try catch and in catch you need not do anything…so that the value is passed out

cheers

@Anil_G
But then if I understand you correctly, because of the internal TRY CATCH it will continue without a problem and then the main TRY CATCH (the one that is on all the WHEN) will also continue to more WF’s and I want it not to do that. I want it to stop as soon as there is a fall and continue from there to the “THEN” part.

@mironb

for that use an if condition and check the out argument value if the value is success then move format else throw an error so that the next workflow is not continued

cheers

@Anil_G
To stop the TRY.CATCH I need to pass a Throw to it
If it fails in one of the internal WF’s.
I can’t pass an argument out of it because it’s not shown in WHEN I guess it’s because there’s a THROW
In other words, when there is a THROW, is it not possible to move arguments out of its part?

@mironb

so your workflow should be like this

when part
workflow 1
if condition - throw error if not success
workflow 2
if condition - throw error if not success
etc

inside workflow 1
Try
All the activities
at the end set out argument value to success
catch
Set the out argument value to any failure message

this way using the argument value we can decide if the workflow is success full or not

and yes when there is error generally arguments are not passed out

cheers

@Anil_G
“at the end set out argument value to success
catch
Set the out argument value to any failure message”
What do you mean by saying “at the end”?

I have this check in the end of 1 WF

@mironb

on the verify success side set the argument to success

and instead of throwing error set the argument value to the error you want to throw

so that the argument is passed out

cheers

@Anil_G
So you say instead of using “THROW” in the right part of the example’ just to use assign with the out_message and the value its not OK ?
But if I do so the WHEN part where there are some more WF’s continue to the rest of the WF’s
and not stopped and doesn’t moving to the THEN part

@mironb

You have to use a if condition in when part after every invoke workflow to check if the argument value is success or kot…if not success then throw error and it wont go to next

Cheers

@Anil_G
Sorry for confusing you, it works now, thank you very much

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.