Giter Site home page Giter Site logo

kekoa- / sikuli-framework Goto Github PK

View Code? Open in Web Editor NEW

This project forked from smysnk/sikuli-framework

0.0 2.0 0.0 64.43 MB

SikuliFramework provides an object-oriented abstraction on top of Sikuli to assist with interacting GUI elements, such as sets of buttons, checkboxes, radio buttons, windows and dialogue hierarchies for GUI automation and testing.

License: Other

Python 100.00%

sikuli-framework's Introduction

SikuliFramework - GUI Automation Framework for Sikuli

SikuliFramework provides an object-oriented abstraction on top of Sikuli to assist with interacting GUI elements, such as sets of buttons, checkboxes, radio buttons, windows and dialogue hierarchies for GUI automation and testing.

What is Sikuli?

Sikuli is a visual technology to automate and test graphical user interfaces (GUI) using images (screenshots) of the software under test.

Common problems with traditional "Sikuli scripts"

Most traditional "Sikuli scripts" are created by capturing baseline images around a series of steps required to solve a particular problem. This allows for the quick creation of a script to solve a problem. There are however a few inherent problems with creating scripts in this method, these include:

  • Maintainability issues
    • Baseline images are usually very specific to a test and cannot be reused
    • If the any of the baseline images change, multiple baseline images need be fixed for 1 change in the UI
    • No enforced naming convention for baseline pictures (Everyone has a different way of naming things)
  • Fragile tests
    • "Sikuli script" often devolve into "hacky" code to get the job done, but it is hard to create truly maintainable tests
      • Use of wait(seconds) function depends on computer being fairly fast or increased time is needed, lots of time is wasted waiting around, decreases the readability of tests if there are wait commands everywhere
      • Operations are performed without validating whether the system is actually in sync
        • Clicking a checkbox, is the checkbox actually selected after the operation?
        • Entering text, is the text entered as you expect it?
        • Did clicking a button actually perform the action you expected it to? A regular Sikuli script will only fail after it cannot find an image it is expecting to present on the screen

SikuliFramework was created to solve some of the complexities and also offers the following benefits:

  • Cleaner, more readable code
  • Provides structure to the naming of baseline images
  • Dynamic resolution of image assets (Designate different images based on OS)
  • Encourages baseline reuse (Rather than capturing images to solve your immediate task, capture to solve all tasks)
  • Higher accuracy matching GUI components due to use of Regions
  • Tight integration with RobotFramework - Inspired by Mike's cognition's Blog
  • Encourages code reuse in RobotFramework test libraries
  • Streamlines baseline creation for assertions (baselines are created automatically during the initial run of the script)
  • Solves some of Sikuli's common downfalls (false-positives, context issues)
  • Greatly improved reports for debugging and general-purpose
  • Increases the robustness of test scripts (less dependant on speed of the machine, resolution, other problems)

Code Examples

Work with applications in a more natural object-oriented way

calculator = Calculator()

# Chain together operations on the same window 
calculator[Calculator.BUTTON_2].click()
    [Calculator.BUTTON_PLUS].click()
    [Calculator.BUTTON_2].click() 
    [Calculator.BUTTON_EQUALS].click()
    
# Built-in assertions methods for testing purposes
calculator[Calculator.SCREEN].assertEquals("4")

Integrates with RobotFramework to create extremely readable tests

*Setting*
Library	keywords/CalculatorLib.py	WITH NAME	Calculator

*Test Case*
Add Two Numbers
    Calculator.Launch
    Calculator.Click         Two
    Calculator.Click         Plus
    Calculator.Click         Two
    Calculator.Click         Equals
    ${Screen}=               Calculator.Select   Display
	Calculator.AssertEquals	 ${Display}           4

RobotFramework Results Log

Augments RobotFramework's log.html message statements, adding inline hyperlinking to captured images

RobotFramework Results Log Hyperlinking

Map out special GUI elements such as a TextBox, Radio, Checkbox + more and interact with them as such

calculator[Calculator.SCREEN].type("25")

Map out the resulting actions of clicking a button

# Create initial application context
textedit = TextEdit()

# Result of clicking the TextEdit button is a TextEditMenu
textEditMenu = textedit[TextEdit.MENU_BAR][MenuBar.TEXTEDIT].click()

# Perform actions on the new context created from the result of the previous action
textEditMenu[TextEditMenu.QUIT].click()

Getting Started

Documentation + Tutorials


Created by Joshua Bellamy-Henn

sikuli-framework's People

Watchers

 avatar  avatar

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.