GithubHelp home page GithubHelp logo

kaluluosi / eventlibrary Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mkorpela/eventlibrary

0.0 2.0 0.0 8 KB

Event dispatcher Library for Robot Framework

Python 66.84% RobotFramework 33.16%

eventlibrary's Introduction

EventLibrary

Event Library for Robot Framework. This allows one to say that when A happens then do X and when B happens then do Y.

One could argue that there are 3 levels of waiting:

  1. Sleeper: Sleep
  2. Poller: Wait Until
  3. Observer: Invoke When

This library aims to allow you to act with the 3 option.

*** Settings ***
Library  EventLibrary

*** Variables ***
${SKY}   dark

*** Test Cases ***
Invoke Later Test
  ${hello}=  Invoke Later  Log  Hello
  ${world}=  Invoke Later  Log  World
  Wait Until Events Happened  ${hello}  ${world}

Invoke After Test
  ${event}=  Invoke After  0.5  Log  Printed after 0.5 seconds
  Wait Until Events Happened  ${event}

Invoke When Test
  Set sky color to blue
  ${orange}=  Invoke When  Sky is orange  Log  Impossible!!!
  Invoke After  0.1  Set sky color to orange
  Wait Until Events Happened  ${orange}

Invoking in the event loop Test
  Invoke Later  Set sky color to blue
  ${ora}=  Invoke When   Sky is orange   Log end
  Invoke When   Sky is blue     Set sky color to orange
  Wait Until Events Happened  ${ora}

*** Keywords ***
Log end
  ${ends}=  Invoke Later  Log  the end
  Wait Until Events Happened  ${ends}

Set sky color to blue
  Set test variable  ${SKY}  blue

Set sky color to orange
  Set test variable  ${SKY}  orange

Sky is orange
  Should Be Equal    ${SKY}  orange

Sky is blue
  Should Be Equal    ${SKY}  blue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.