Library scope: | GLOBAL |
---|
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.
Helper function to use if maximum invalid value (instead of minimum valid) is known.
Report failure if got the excluded value or if data value changed from last time. Useful to become validator.
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.
Report failure if minimum not reached or data value changed from last time. Useful to become validator.
Helper keyword to distinguish escalable failures by their prefix. If it is escalable, Fail without changing the message; otherwise Return comment.
Pass only if ${assertor} passes ${count} times in a row with ${period} between attempts. Keep assertor state in local variable. Standard arguments.
Pass only if ${assertor} passes ${count} times in a row with ${period} between attempts. Keep assertor state in local variable. Less standard arguments.
Pass only if ${assertor} passes ${count} times in a row with ${period} between attempts; standard arguments.
Pass only if ${assertor} passes ${count} times in a row with ${period_in_seconds} between attempts; less standard arguments.
Analogue of Wait Until Keyword Succeeds, but it passes state of validator around. Calls GASSVHTSCBD to verify data is "stable".
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".
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
Common checks for argument values. Return times in seconds and deadline date implied by timeout time.
Compute time to be wasted in sleeps, compare to deadline. Fail with message when needed.
Call dependency setup. Perhaps needed.