Introduction

Robot keyword library (Resource) with several Keywords for monitoring and waiting.

Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.

This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html

BuiltIn.Wait_Until_Keyword_Succeeds has two possible results: Fast pass or fail on timeout. Generally, keywords in this Resource also allow for some kind of fast failure condition. This usually requires more than a single keyword to run inside the iteration loop. This library uses ScalarClosures for plugging in specific (multiple) Keywords.

Storing private state in suite variables is easy, but it can lead to hard-to-debug issues, so this library tries to support explicit state passing. Unfortunately, failing limits type of message to return, so implementation of some Keywords looks quite convoluted.

Particular closures are to be given by caller: Stateless Assertor: Take no arguments. Return comment or Fail with message. Stateful Assertor: Take single ${state} argument. Return new state and comment, or Fail with message. (Stateless) Getter: Take no argument. Return single scalar data, or Fail with message. Stateless Validator: Take single ${data} argument. Return comment, or Fail with message. (Unsafe) Stateful Validator: Take ${state} and ${data} arguments. Return new state and comment, or Fail with message. Safe Stateful Validator: Take ${state} and ${data} arguments. Return new state, validation status and comment/message. TODO: Create a dummy closure for each type to be used as default value?

TODO: Figure out a way to merge this with WaitForFailure.robot TODO: Add Keywords that are Safe (return state, success and message) so that callers do not need to refresh state explicitly.

Keywords

Arguments

maximum_invalid
= -1

Documentation

Helper function to use if maximum invalid value (instead of minimum valid) is known.

Arguments

old_state data excluded_value
= -1

Documentation

Report failure if got the excluded value or if data value changed from last time. Useful to become validator.

Arguments

date_deadline
= 0
period_in_seconds
= 1
count
= 1
getter
= ${ScalarClosures__fail}
safe_validator
= ${ScalarClosures__fail}
initial_state
= ${NONE}

Documentation

Pass only if consecutively ${count} times in a row with ${period} between attempts: ${getter} creates data and ${safe_validator} passes. Validator updates its state even if it reports failure. Always return validator state, status and message.

Arguments

old_state data valid_minimum
= -1

Documentation

Report failure if minimum not reached or data value changed from last time. Useful to become validator.

Arguments

message
= ${EMPTY}
prefix
= magic

Documentation

Helper keyword to distinguish escalable failures by their prefix. If it is escalable, Fail without changing the message; otherwise Return comment.

Arguments

timeout
= 60s
period
= 1s
count
= 1
assertor
= ${ScalarClosures__fail}
initial_state
= ${NONE}

Documentation

Pass only if ${assertor} passes ${count} times in a row with ${period} between attempts. Keep assertor state in local variable. Standard arguments.

Arguments

date_deadline
= 0
period_in_seconds
= 1
count
= 1
assertor
= ${ScalarClosures__fail}
initial_state
= ${None}

Documentation

Pass only if ${assertor} passes ${count} times in a row with ${period} between attempts. Keep assertor state in local variable. Less standard arguments.

Arguments

timeout
= 60s
period
= 1s
count
= 1
assertor
= ${ScalarClosures__fail}

Documentation

Pass only if ${assertor} passes ${count} times in a row with ${period} between attempts; standard arguments.

Arguments

date_deadline
= 0
period_in_seconds
= 1
count
= 1
assertor
= ${ScalarClosures__fail}

Documentation

Pass only if ${assertor} passes ${count} times in a row with ${period_in_seconds} between attempts; less standard arguments.

Arguments

timeout
= 60s
period
= 1s
count
= 1
getter
= ${ScalarClosures__fail}
safe_validator
= ${ScalarClosures__fail}
initial_state
= ${NONE}

Documentation

Analogue of Wait Until Keyword Succeeds, but it passes state of validator around. Calls GASSVHTSCBD to verify data is "stable".

Arguments

timeout
= 60s
period
= 1s
count
= 1
getter
= ${ScalarClosures__fail}
safe_validator
= ${ScalarClosures__fail}
initial_state
= ${NONE}

Documentation

Analogue of Wait Until Keyword Succeeds, but it passes state of validator around and exits early on getter failure. Calls GASSVHTSCBD to verify data is "stable".

Arguments

timeout
= 60s
period
= 1s
getter
= ${ScalarClosures__fail}
stateless_validator
= ${ScalarClosures__identity}

Documentation

Repeatedly run getter and plug its output to validator. If both pass, return validator message. If getter fails, fail. If validator fails, repeat in WUKS fashion (fail when timeout is exceeded). FIXME: Cover this keyword in WaitUtilTest.robot

Arguments

timeout
= 60s
period
= 1s
count
= 1

Documentation

Common checks for argument values. Return times in seconds and deadline date implied by timeout time.

Arguments

date_deadline
= 0
period_in_seconds
= 1
sleeps_left
= 1
message
= No attempt made.

Documentation

Compute time to be wasted in sleeps, compare to deadline. Fail with message when needed.

Documentation

Call dependency setup. Perhaps needed.

WaitUtils

image/svg+xml