Reply
Contributor
bbaker
Posts: 124
Registered: 09-16-2009
0
Accepted Solution

Rule Action Execution

I have a question on how the Rule Actions are executed.  In my testcase, I issue a show command to a device.  The results depend on several factors, so I need to be able to implement some logic in the pass/fail criteria.  Basicly what I have is this:

 

command - show something

analze - output

assert

   when true

                    - pass test

   when false

                    - Repeat Step max10; delay 10

                    - Call Procedure goDoSomethingToHelp

                    - Repeat Step max10; delay 10

                    - Fail Test

                    - Declare Execution Issue

 

When the procedure call to "goDoSomethingToHelp" is actually executed, the Fail Test event has already run.  So the test fails, then the procedure is executed which resolves the problem, and then the second Repeat Step is executed and the test generates a pass event.

 

Shouldn't the test only fail after the second Repeat Step sequence has been exhausted?

 

Community Leader
AdamB
Posts: 723
Registered: 09-01-2008
0

Re: Rule Action Execution

You can do that by moving your "fail" state to an event for that step:

"OnRepeatStepMaxCountExceeded"


This is actually the first available event.

 

Another option is to put this into conditional logic outside the step, your step sets a variable and using while or for logic, you do your repetitions.  I actually recommend this as it makes the test more readable.  i.e. all the flow is right there for people to see, in rough psudo code.

 

 

eval set found 0
for (i=0->10) command.show something
      assert: value = expected
        when true
          eval set found 1
          break
        when false
          nothing
   call proc_to_help

eval get found
   assert: found==1
     when true
        pass test
     when false
        fail test

 

 


Does this post answer your question? Click the "Accept as solution" button.

Was this post helpful? Click the yellow "Kudos!" button.
Contributor
bbaker
Posts: 124
Registered: 09-16-2009
0

Re: Rule Action Execution

[ Edited ]

So is my assumption that the Rule Actions are executed in order false?

 

I'll probably redo my test so the conditional logic is outside of a single step, but I want to make sure I understand the Rule Action processing.

Community Leader
AdamB
Posts: 723
Registered: 09-01-2008
0

Re: Rule Action Execution

They are executed in order, but they are ALL executed, and actions like call and repeatStep are queued up to execute after all events have been processed. These deferred actions are then executed in the order they were deferred in.

 

-a


Does this post answer your question? Click the "Accept as solution" button.

Was this post helpful? Click the yellow "Kudos!" button.