Documentation - ohomola/gears GitHub Wiki

List of keywords

Analysis

Turns on troubleshooting mode. During troubleshooting mode you will see detailed information in console about executed commands. Additionally each UI action will be highlighted for a short period of time on the screen before any action taken. Use AnalysisOff to turn off the troubleshooting moode.

Console usages

analysis

AnalysisOff

Turns off troubleshooting mode. See Analysis.

Console usages

analysisoff

Back

Moves selected keyword one step back. You can also add a number parameter to specify the numer of steps.

Console usages

back
back 4

Clear

Clears a text input element (or dropdown) located by a visible text on the screen. The input parameter is a query instruction passed as a string to parameter What.

See Fill for more info.

Scenario usages

Discriminator What
Clear login
Clear input right from login

Console usages

clear

Additional properties

Click

Clicks an element identified by a visible text on the screen. The input parameter is a query instruction passed as a string to parameter 'What'. See Web element instructions for more info.

Scenario usages

Discriminator What
Click Save
Click 1st button 'save customer' below 'New Customer'
Click 1st button like 'save' below 'New Customer'
Click 4th button from right

Console usages

click save
click 4th button from right
show click save

Additional properties

Close

Closes currently open Scenario file an empties the Keyword Execution Plan.

Console usage

close

Comment

Writes text to console. Use this to comment scenario.

Scenario usage

Discriminator Text
Comment Hello world

Console usage

comment Hello world

CsvScenarioReport

Creates output file containing results of the scenario in table format.

Note: To add this to any scenario, you can also use a command-line argument when executing Gears Interpreter -CsvScenarioReport

Console usage

CsvScenarioReport
show CsvScenarioReport

DragAndDrop

Drags an element identified by a visible text on the screen. The input parameter is a query instruction passed as a string to parameter 'What'. See Web element instructions for more info. Additional parameters X and Y indicate the vector of the 'drag' action.

With Analysis on, the drag action will become slower for visual verification. Using Show will highlight the rough line of the drag vector.

Scenario usages

Discriminator What X Y
DragAndDrop 1st button 'Add customer' below 'New Customer' 300 0

Console usages

draganddrop 300 0 1st widget button    
show draganddrop 300 0 1st widget button    

Additional properties

ErrorLogging

Configuration Type used to automatically take screenshots on error or other error messages during execution.

Note: This is a configuration, not an active keyword. It changes behaviour of your scenario by merely existing in your data context. Use 'Use' keyword to add it to your context and 'Off' keyword to take it away.

Scenario usages

Discriminator What
Use ErrorLogging
IsVisible Something which is broken
Off ErrorLogging

Console usages

use ErrorLogging
run
ErrorLogging off

Eval

When your selected keyword contains unresolved expression (e.g. reference to a memorized value), this keyword will explicitly resolve that expression without executing the keyword. Note that keywords are resolved automatically when run, so you don't need this keyword when using expressions. This keyword is intended for debugging your scenario.

Console usage

eval

Fill

Fills a text input element (or dropdown) located by a visible text on the screen. The input parameter is a query instruction passed as a string to parameter What.

The Fill understands simple instructions differently than Click , which means you do not need to specify 'input next to login' each time you are looking for input labelled 'login'. Instead you can ask just for 'login' - Fill assumes you're looking for something that has a label next to it somewhere.

Text parameter is the text to be filled into the element.

Scenario usages

Discriminator What Text
Fill login user1
Fill input right from login password

Console usages

fill login with user1
fill input right from login with password
show fill login with user1

Additional properties

Forget

Forgets remembered values, which were previously added by Remember keyword. If specified without parameter, removes all remembered values.

Console usage

forget
remember url http://www.hello.world.com
forget url

GoTo

Skip the plan to Nth step. Use this to skip steps without executing them.

Console usage

goto 45

GoToUrl

Navigates browser to specified URL. Note that the url must be fully formated, (e.g. beginning with http://).

Scenario usage

Discriminator URL
GoToUrl https://github.com/ohomola/gears/wiki/Documentation

Console usage

gotourl https://github.com/ohomola/gears/wiki/Documentation

HasText

Checks a text input element (or dropdown) located by a visible text on the screen. The input parameter is a query instruction passed as a string to parameter What.

The HasText understands simple instructions differently than Click , which means you do not need to specify 'input next to login' each time you are looking for input labelled 'login'. Instead you can ask just for 'login' - HasText assumes you're looking for something that has a label next to it somewhere.

Text parameter is the text expected.

Scenario usages

Discriminator What Text Expect
HasText login user1 TRUE
HasText input right from login password TRUE

Console usages

hastext login myname

Additional properties

Help

Displays console help with the list of common keywords.

Console usages

help

Include

Discriminator FileName
Include C:/myTest.Csv
Include ./../mytests/myTest.Csv

Path can be relative to the Interpreter applicaion location

IsSelected

Checks if a checkbox or similar input is selected

Scenario usages

Discriminator What Expect
IsSelected Accept Terms and Conditions true

Console usages

IsEnabled Accept Terms and Conditions

Note: console usages always Expect true result (you cannot specify Expect parameter when calling the keyword from console)

Additional properties

IsVisible

Checks the presence of a web element or text in the browser window. The input parameter is a query instruction passed as a string to parameter 'What'. See Web element instructions for more info.

Scenario usages

Discriminator What Expect
IsVisible Save true
IsVisible 1st button 'save customer' below 'New Customer' false
IsVisible 4th button from right true

Console usages

IsVisible save
IsVisible 4th button from right

Note: console usages always Expect true result (you cannot specify Expect parameter when calling the keyword from console)

Additional properties

JUnitScenarioReport

Creates output file containing results of the scenario in JUnit-compatible XML format.

Note: To add this to any scenario, you can also use a command-line argument when executing Gears Interpreter -JUnitScenarioReport

Console usage

JUnitScenarioReport
show JUnitScenarioReport

Login

Off

Removes all objects of specified Type from Context. Use this keyword to turn off a configuration previousl turned-on by Use keyword.

Note: Off keyword is used as last word in your console command (unlike most keywordw which are itentified as first word in your instruction). Do not use it as 'off SkipAssertions' as it will not be recognized that way.

Console usages

use SkipAssertions
run
SkipAssertions off

Additional properties

Open

Opens a specified scenario file.

Console usage

open c:/mytest.csv

Reload

Reloads the scenario. Use this along with a shared xls document to build automated tests on-the-fly. Specify a text parameter to only reload a specific file which contains the parameter in it's path.

Console usage

reload
open c:/myfile_withTest123.xlsx
reload myfile

Remember

Saves a specified value to a variable for later use. Your currently memorized variables are displayed in the console status.

Scenario usages

Discriminator What Variable
Remember user1 myLogin
Fill login [myLogin]
Remember {Generate.Word(3)} randomWord
Fill password [randomWord]

Console usages

 remember myUser John

Resize

Forces window to take a certain size. The purpose is to stabilise tests in responsive-design applications.

Scenario usages

Discriminator What Width Height
Resize browser 640 480

Console usage

resize browser 640 480

Additional properties

Run

Executes selected number of steps of your scenario. Use this if you want to run your plan up to given step. Use 'all' instead of a number to execute from current step to end of scenario.

Console usages

run 4
run all

RunScenario

Execute entire scenario plan file. Use this keyword to define scenario-of-scenarios (i.e. Suite).

Note: You can debug a scenario containing RunScenario steps normally, however the entire RunScenarios will be called end-to-end, you cannot step inside them.

Scenario usage

Discriminator FileName
RunScenario ./Test1.xlsx

SaveHtml

Saves current webpage in browser to a file. This file might be different to what your browser would save. Use this to create HTML snapshots as attachments for bugs.

Scenario usage

Discriminator
SaveHtml

Console usage

savehtml

Note: File will be created to the same Output folder as your scenario reports and will have a unique generated name. You can configure the default path in Gears.Interpreter.exe.config

SaveScreenshot

Saves current browser screen to an image file. What parameter indicates a filename prefix to the created file. Suffix of the file name will be generated.

Scenario usage

Discriminator What
SaveScreenshot Screen1
SaveScreenshot

Console usage

SaveScreenshot
SaveScreenshot test1

Note: File will be created to the same Output folder as your scenario reports and will have a unique generated name. You can configure the default path in Gears.Interpreter.exe.config

Show

Displays the inteded action. Used for troubleshooting or while developing new tests.

When used without parameter, will try to show selected plan keyword. Note that not all keywords are 'showable' (typically only UI actions are showable)

Other usage is prefixing other keyword console commands with the word show. This will perform the same as above, except against the specified command.

Console usage

show
show click 1st login button
show fill textfield above password
show csvscenarioreport

Note: Show will use an overlay window to indicate the location of the element. This will stay displayed until a console prompt is confirmed. Note that this blocks your test until user performs an action so it is not recommended to use in live tests.

Skip

Skips selected number of steps of your scenario.

Console usages

skip 4

SkipAssertions

Configuration Type used to turn off assertions executions.

Note: This is a configuration, not an active keyword. It changes behaviour of your scenario by merely existing in your data context. Use 'Use' keyword to add it to your context and 'Off' keyword to take it away.

Scenario usages

Discriminator What
Use SkipAssertions
IsVisible Somthing which is broken and we know it
Off SkipAssertions

Console usages

use SkipAssertions
run
SkipAssertions off

StepOut

Steps out of a scenario. Used only when currently inside a scenario (via Show RunScenario).

Console usages

stepout

Stop

Stops the scenario execution and closes the application.

Console usages

stop

Use

Adds object of specified Type to Context. Use this keyword to turn on a configuration.

Console usages

use SkipAssertions
run
SkipAssertions off

Additional properties

Wait

Waits for specified number of miliseconds

Scenario usage

Discriminator What
Wait 1000

WhatIsIt

Prompts user to indicate a webelement of interest to the application. The application will then attempt to figure out the simplest instruction how to describe this element.

The generated instruction will be saved in [it] variable so it can be immediatelly tested in a followup 'click [it]' command.

Note: This is a concept version only. Currently only works on Buttons and Links and not all instructions are guaranteed to work at all circumstances.

Console usage

whatisit

Note: Your browser will be overlayed by a highlight form window. This will make your browser content unaccessible until you click the overlay.

Common Keyword properties

SKIP

Any keyword can be tagged to be always skipped (not executed) by adding column called 'Skip' with value equal to TRUE (case insensitive).

WaitAfter

You can specify the amount of miliseconds to wait after execution of a keyword with this field. Purpose is to save cluttering your scenario with Wait steps if your website is timeout sensitive.

WaitBefore

You can specify the amount of miliseconds to wait before execution of a keyword with this field. Purpose is to save cluttering your scenario with Wait steps if your website is timeout sensitive.

ScreenshotAfter

Use True/False to turn on screensaving after execution of the keyword. You can also use specific string instead to give the screenshot a filename prefix (equivalent to giving a What argument to Savescreenshot keyword)

Scenario usages

Discriminator What WaitAfter
Click login 250

Web element instructions

Web element instruction is a text passed to all web-based keywords to specify the query for the keyword. Instruction must follow a simplified english expression syntax. The syntax structure effectivelly breaks the text into several components by it's structural position. There total of 5 different elements:

Syntax parts

  1. Order - this indicates you're asking for Nth element. For example the '1st' in '1st button'. If not specified, 1 is used.
  2. Subject type - Indicates the type of element you are looking for. Default is Any element type. If specified can be one of the following:
  • button
  • link
  • input
  • textArea (treated same as input)
  • textfield (treated same as input)
  1. Accuracy - use word 'like' before indicating Subject name to allow partial text matches. Skip this to match only entire text of element.
  2. Subject name - visible name of what you are looking for. This must be full - no partial matches are considered.
  3. Direction - indicates where you are looking for the element. Default is 'Near' which is generic enough although not reliable when multiple occurences of the seached element exist. This can be also one of the following values:
  • left from - only takes elements left from another element (must provide Locale)
  • right from - only takes elements right from another element (must provide Locale)
  • above - only takes elements above another element (must provide Locale)
  • below - only takes elements below another element (must provide Locale)
  • from right - goes from right edge of the browser i.e. sorts elements by their X coordinates descending.
  • from left - goes from left edge of the browser i.e. sorts elements by their X coordinates ascending.
  • from bottom- goes from left edge of the browser i.e. sorts elements by their Y coordinates descending.
  • from top - goes from left edge of the browser i.e. sorts elements by their Y coordinates ascending.
  1. Locale specified only if relative direction is specified. This is a visible text of another element.

The query is interpreted in the following manner:

Whole instruction Order Subject Type Subject Name Direction Locale
1st input Password right from Login 0 Input Password RightFrom Login

Note that none of the parts is mandatory, so the following samples are all valid (if perhaps not all sensible):

| Whole instruction | Order | Subject Type | Subject Name | Direction | Locale | Accuracy | |--- | ----- | ---- | ------- | --------- | ---- | Exact | | button | 1 | Button | Anything | Anywhere| | Exact | | login | 1 | Anything | Login | Anywhere| | Exact | | 1st | 1 | Anything | Login | Anywhere| | Exact | | above login | 1 | Anything | Anything | Above | Login | Exact | | 2th login | 2 | Anything | Login | Anywhere| | Exact | | 2nd button like log | 2 | Button | Log | Anywhere| | Partial | | like 'log' | 0 | Anything | Log | Anywhere| | Partial |

Nothing is case-sensitive.

Expressions

Expressions are parts of user instructions written with special syntax, that cause the system to evaluate them into different values. Those are either used for data parametrisation of tests (via remembered values expressions) or for run-time actions such as randomly generated numbers, dates, or math operations.

Remembered variables

Remembered variables are referenced by expressions in brackets []. Use these anywhere in text to cause system to evaluate the brackets into the variable's value. See Remember for more info.

Code chunk

TODO

Command line arguments

Memory variables

You can instruct the application to automatically add a variable on start time by adding argument with specific syntax

The following example will add a variable myVariable with value "HelloWorld".

Gears.Interpreter.exe -myVariable=HelloWorld

Sample usage is to specify base url for your application tests and control them from outer scope.