Question

In my automated test I have an area that occasionally shows up (and needs to be clicked on when it does show up). This is the perfect place to use an OptionalStep prefix, to prevent the step from failing if the optional area never shows up.

Thing is, I would like the OptionalStep to only wait a second or two before moving on to the rest of the test. Just as I can have object.Exist(2) only wait for 2 seconds, is there a way to have OptionalStep wait for only a couple of seconds?

Some other caveats:

  • I'd like to keep this as one small line. I know I could create a multi-line logic test that uses object.Exist(2) inside an If/Then statement, but I'd rather have the code be small and trim.
  • I don't want to change the global 20 second timeout just for this one step.
  • Since this optional step only shows up in one specific area, it seems like Recovery Scenarios would not be a good choice to have running throughout the entire test.
Était-ce utile?

La solution

Vitaly's comment would be a good solution as you are possibly unnecessarily over complicating your test.

Also having such a long global timeout is not recommended and should be as low as possible. I usually have it set at around 3 seconds and deal with the synchronisation in the code.

Anything that takes a long period of time should be known about upfront and dealt with in the code. Having a global timeout for everything will cause your test to run unnecessarily slow when most object cannot be found errors occur.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top