Skip to content

Commit

Permalink
Merge pull request #92 from Omenia/docfix
Browse files Browse the repository at this point in the history
Small fixes and improvements to documentation
  • Loading branch information
eeromakiesko authored Feb 12, 2019
2 parents 1fda5de + 8f1befc commit 2430630
Show file tree
Hide file tree
Showing 17 changed files with 107 additions and 93 deletions.
41 changes: 25 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
WhiteLibrary provides the means to test Windows GUI technologies with Robot Framework. WhiteLibrary wraps White test automation framework [\[1\]](#white).
# Introduction

# Technologies #
WhiteLibrary provides the means to automate Windows GUI technologies with Robot Framework.
WhiteLibrary wraps the [White automation framework](https://github.com/TestStack/White).

Supported technologies include:
* Win32
* WinForms
* WPF (Windows Presentation Foundation)
* SWT (Java) platforms

# Installation #
# Installation

## Stable version ##
### Stable version
Installing the latest stable release:
```
pip install --upgrade robotframework-whitelibrary
```
## Development version ##

[Release notes](https://github.com/Omenia/robotframework-whitelibrary/releases)

### Development version
Installing the version containing the latest updates in ``master``:
```
pip install --upgrade --pre robotframework-whitelibrary
```
# Documentation #
Keyword [documentation](http://omenia.github.io/robotframework-whitelibrary/keywords.html)
# Documentation
* [Keyword documentation](http://omenia.github.io/robotframework-whitelibrary/keywords.html)

# Development environment
This section contains instructions for developing WhiteLibrary.

# Development Environment #
## Prerequisities ##
### Prerequisities
* Install [NuGet Command Line Interface (CLI)](https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference) to install required DLL packages (TestStack.White and Castle.Core).
* Install [Python](https://www.python.org/downloads/), if not already installed. Versions 2.7, 3.5 and 3.6 are supported at the moment.
* To install Robot Framework and Python for .NET, run
Expand All @@ -29,14 +39,17 @@ pip install robotframework pythonnet
```
* To make modifications to and build the test application (UIAutomationTest.exe), install [Visual Studio](https://visualstudio.microsoft.com/). The test application is a WPF application developed with C#.
* If you want to edit Python with Visual Studio, Python Tools are required. They're part of Visual Studio 2017 installer, see details about what to select during installation: https://github.com/Microsoft/PTVS
## WhiteLibrary installation ##
### WhiteLibrary installation
* To install WhiteLibrary from source, in the root folder of the project run
```
local_install.cmd
```
* Open `UIAutomationTest\UIAutomationTest.sln` and build the solution in Visual Studio. This will create the SUT executable, `UIAutomationTest\bin\Debug\UIAutomationTest.exe`.

## Running tests with Robot Framework ##
### Building the test application
Open `UIAutomationTest\UIAutomationTest.sln` in Visual Studio and build the solution in Visual Studio.
This will create the executable used in the Robot test suite, `UIAutomationTest\bin\Debug\UIAutomationTest.exe`.

### Running tests with Robot Framework
* To execute the test suite against SUT, in the root folder of the project run
```
robot --outputdir output --exclude no_ci --loglevel DEBUG:INFO atests
Expand All @@ -46,7 +59,3 @@ robot --outputdir output --exclude no_ci --loglevel DEBUG:INFO atests
robot --outputdir output --exclude no_ci --loglevel DEBUG:INFO -t "Example Test Case" atests
```
* The test suite tagged with `no_ci` will run tests against the old (Win32) version of Windows calculator, and is typically excluded from test runs.

# References #

\[1\] <a name="white">https://github.com/TestStack/White</a>
9 changes: 0 additions & 9 deletions atests/feature_tests/items.robot
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,6 @@ Popup menu with subitems
Click Button text=OK
[Teardown] Select Tab Page tabControl Tab1

Handle Delayed Actions
[Timeout] 10
[Setup] Setup for Tab 2 Tests
Click Button text=Fast alert
Wait Until Keyword Succeeds 5 sec 5 sec Fast alert Should Be Occurred
Click Button text=Slow alert
Wait Until Keyword Succeeds 5 sec 5 sec Fast alert Should Be Occurred
[Teardown] Select Tab Page tabControl Tab1

*** Keywords ***
Calculate ${num1} ${operator} ${num2} Equals ${result}
Input Text To Textbox txtA ${num1}
Expand Down
35 changes: 20 additions & 15 deletions src/WhiteLibrary/keywords/items/buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
class ButtonKeywords(LibraryComponent):
@keyword
def click_button(self, locator):
""" Clicks button.
"""Clicks a button.
``locator`` is the locator of the button.
Locator syntax is explained in `Item locators`.
"""
button = self.state._get_typed_item_by_locator(Button, locator)
button.Click()
Expand All @@ -18,6 +19,7 @@ def button_text_should_be(self, locator, expected_text, case_sensitive=True):
"""Verifies exact text in a button.
``locator`` is the locator of the button.
Locator syntax is explained in `Item locators`.
``expected_text`` is the expected button text.
Expand All @@ -31,6 +33,7 @@ def button_text_should_contain(self, locator, expected_text, case_sensitive=True
"""Verifies expected text is found in a button.
``locator`` is the locator of the button.
Locator syntax is explained in `Item locators`.
``expected_text`` is the expected button text.
Expand All @@ -54,20 +57,20 @@ def verify_button(self, locator, expected):

@keyword
def select_radio_button(self, locator):
"""
Selects a radio button.
"""Selects a radio button.
``locator`` is the locator of the radio button.
Locator syntax is explained in `Item locators`.
"""
radiobutton = self.state._get_typed_item_by_locator(RadioButton, locator)
radiobutton.Select()

@keyword
def verify_radio_button(self, locator, expected):
"""
Verifies state of a radio button.
"""Verifies state of a radio button.
``locator`` is the locator of the radio button.
Locator syntax is explained in `Item locators`.
``expected`` is the expected state (True/False).
"""
Expand All @@ -76,31 +79,32 @@ def verify_radio_button(self, locator, expected):

@keyword
def get_radio_button_state(self, locator):
"""
Gets the state of a radio button.
"""Returns the state of a radio button.
``locator`` is the locator of the radio button.
Returns `True` if the radio button is selected, `False` if not.
``locator`` is the locator of the radio button.
Locator syntax is explained in `Item locators`.
"""
radiobutton = self.state._get_typed_item_by_locator(RadioButton, locator)
return radiobutton.IsSelected

@keyword
def toggle_check_box(self, locator):
"""
Toggles a check box.
"""Toggles a check box.
``locator`` is the locator of the check box.
Locator syntax is explained in `Item locators`.
"""
checkbox = self.state._get_typed_item_by_locator(CheckBox, locator)
checkbox.Toggle()

@keyword
def verify_check_box(self, locator, expected):
"""
Verifies state of a check box.
"""Verifies state of a check box.
``locator`` is the locator of the check box.
Locator syntax is explained in `Item locators`.
``expected`` is the expected state (True/False).
"""
Expand All @@ -109,11 +113,12 @@ def verify_check_box(self, locator, expected):

@keyword
def get_check_box_state(self, locator):
"""
Gets the state of a check box.
"""Returns the state of a check box.
``locator`` is the locator of the check box.
Returns `True` if the check box is selected, `False` if not.
``locator`` is the locator of the check box.
Locator syntax is explained in `Item locators`.
"""
checkbox = self.state._get_typed_item_by_locator(CheckBox, locator)
return checkbox.IsSelected
9 changes: 4 additions & 5 deletions src/WhiteLibrary/keywords/items/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
class LabelKeywords(LibraryComponent):
@keyword
def verify_label(self, locator, expected):
"""
Verifies text of a label.
"""Verifies text of a label.
``locator`` is the locator of the label.
Locator syntax is explained in `Item locators`.
``expected`` is the expected text.
"""
Expand All @@ -18,11 +18,10 @@ def verify_label(self, locator, expected):

@keyword
def get_text_from_label(self, locator):
"""
Gets text from a label.
"""Returns the text of a label.
``locator`` is the locator of the label.
Locator syntax is explained in `Item locators`.
"""
label = self.state._get_typed_item_by_locator(Label, locator)
return label.Text
7 changes: 7 additions & 0 deletions src/WhiteLibrary/keywords/items/listcontrols.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def select_listbox_value(self, locator, value):
"""Selects a value from a listbox.
``locator`` is the locator of the listbox.
Locator syntax is explained in `Item locators`.
``value`` is the value to be selected.
"""
Expand All @@ -21,6 +22,7 @@ def select_listbox_index(self, locator, item_index):
"""Selects an item by its index from a listbox.
``locator`` is the locator of the listbox.
Locator syntax is explained in `Item locators`.
``item_index`` is the index of the item to select.
"""
Expand All @@ -34,6 +36,7 @@ def listbox_selection_should_be(self, locator, expected):
Fails if the selection was not as expected.
``locator`` is the locator of the listbox.
Locator syntax is explained in `Item locators`.
``expected`` is the expected selection value.
"""
Expand All @@ -47,6 +50,7 @@ def select_combobox_value(self, locator, value):
"""Selects a value from a combobox.
``locator`` is the locator of the combobox.
Locator syntax is explained in `Item locators`.
``value`` is the value to be selected.
"""
Expand All @@ -59,6 +63,7 @@ def select_combobox_index(self, locator, item_index):
Selects a value from combobox by using its index.
``locator`` is the locator of the combobox.
Locator syntax is explained in `Item locators`.
``item_index`` is the index to be selected.
"""
Expand All @@ -71,6 +76,7 @@ def verify_combobox_item(self, locator, expected):
Verifies the selected value of a combobox.
``locator`` is the locator of the combobox.
Locator syntax is explained in `Item locators`.
``expected`` is the expected selection value.
"""
Expand All @@ -81,6 +87,7 @@ def verify_combobox_selection(self, locator, expected):
"""Verifies that the combobox value is selected.
``locator`` is the locator of the combobox.
Locator syntax is explained in `Item locators`.
``expected`` is the expected selection value.
"""
Expand Down
4 changes: 4 additions & 0 deletions src/WhiteLibrary/keywords/items/listview.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def double_click_listview_cell(self, locator, column_name, row_index):
"""Double clicks a listview cell.
``locator`` is the locator of the listview.
Locator syntax is explained in `Item locators`.
``column_name`` is the name of the column.
Expand All @@ -25,6 +26,7 @@ def double_click_listview_cell_by_index(self, locator, row_index, column_index):
"""Double clicks a listview cell at index.
``locator`` is the locator of the listview.
Locator syntax is explained in `Item locators`.
``row_index`` is the zero-based row index.
Expand All @@ -41,6 +43,7 @@ def double_click_listview_row(self, locator, column_name, cell_text):
"""Double clicks a listview row.
``locator`` is the locator of the listview.
Locator syntax is explained in `Item locators`.
``column_name`` and ``cell_text`` define the row. Row is the first matching row where text in column
``column_name`` is ``cell_text``.
Expand All @@ -56,6 +59,7 @@ def double_click_listview_row_by_index(self, locator, row_index):
"""Double clicks a listview row at index.
``locator`` is the locator of the listview.
Locator syntax is explained in `Item locators`.
``row_index`` is the zero-based row index.
Expand Down
2 changes: 2 additions & 0 deletions src/WhiteLibrary/keywords/items/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def verify_menu(self, locator, expected):
"""Verifies the text of a menu item.
``locator`` is the locator of the menu item.
Locator syntax is explained in `Item locators`.
``expected`` is the expected text of the menu item.
"""
Expand All @@ -20,6 +21,7 @@ def click_menu_button(self, locator):
"""Clicks a menu button.
``locator`` is the locator of the menu button.
Locator syntax is explained in `Item locators`.
"""
menu_button = self.state._get_typed_item_by_locator(Menu, locator)
menu_button.Click()
Expand Down
2 changes: 2 additions & 0 deletions src/WhiteLibrary/keywords/items/mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def drag_and_drop(self, locator1, locator2):
``locator1`` is the locator of the draggable object.
``locator2`` is the locator of the target for the draggable object.
Locator syntax is explained in `Item locators`.
"""
draggable_object = self.state._get_item_by_locator(locator1)
target_object = self.state._get_item_by_locator(locator2)
Expand Down
9 changes: 4 additions & 5 deletions src/WhiteLibrary/keywords/items/progressbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
class ProgressbarKeywords(LibraryComponent):
@keyword
def verify_progressbar_value(self, locator, expected):
"""
Verifies the value of a progress bar.
"""Verifies the value of a progress bar.
``locator`` is the locator of the progress bar.
Locator syntax is explained in `Item locators`.
``expected`` is the expected value of the progress bar.
"""
Expand All @@ -18,11 +18,10 @@ def verify_progressbar_value(self, locator, expected):

@keyword
def get_progressbar_value(self, locator):
"""
Gets the value of a progress bar.
"""Returns the value of a progress bar.
``locator`` is the locator of the progress bar.
Locator syntax is explained in `Item locators`.
"""
progressbar = self.state._get_typed_item_by_locator(ProgressBar, locator)
return progressbar.Value
Loading

0 comments on commit 2430630

Please sign in to comment.