Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 31 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,43 @@
addons:
firefox: latest-esr
language: python
sudo: false
sudo: required
dist: trusty
addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
before_install:
- CDVERSION=`curl http://chromedriver.storage.googleapis.com/LATEST_RELEASE`
- wget http://chromedriver.storage.googleapis.com/$CDVERSION/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- sudo chmod u+x chromedriver
- sudo mv chromedriver /usr/bin/
install:
- pip install .
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
script:
- "if [[ -n ${SELENIUM_VERSION+x} ]]; then pip install -U selenium==${SELENIUM_VERSION}; fi"
- "python test/run_tests.py python \"$BROWSER\""
env:
global:
- secure: "QyY0j8C+hVhsGLv4YU0UMvLm5wBDg6xT5J0Ee77C/JAQ6vcdCMpTfWI8oDxTZb7pBhpDkYuNe747yCYF5PrdBYQbO08FilxctReuJfMXcH44rZC5q49mUmPamkvg1LkzIWuC1s9uKnjlvyDT5ojuPXZl2Vn0gIhSIg+yOyBkM1U="
- secure: "HJaJTYauaBZODMDkbnRVsiCk+t2uVtztkkJ5V4dXSnE1uIBms2PVbufQwb+YNvzHkGheLtpnt/hLM1HhmSFgUtOCf+eumQ6kaLR2KRVEysXwWJzgZoLBidNBOy5rvAIsc9JJbDaIgYVGzyaJGTP9AMb8CyvIPE//lH10sf+GB7g="
matrix:
include:
- os: linux
env:
- BROWSER=firefox
- SELENIUM_VERSION=2.53.6
addons:
firefox: "47.0.1"
python: "2.7"
- os: linux
- python: "2.7" # For PR and cron
env:
- BROWSER=chrome
addons:
sauce_connect: true
python: "2.7"
- os: linux
- SELENIUM=2.53.6
- python: "3.3" # For PR and cron
env:
- BROWSER=firefox
- SELENIUM_VERSION=2.53.6
addons:
sauce_connect: true
python: "3.4"
- os: linux
- BROWSER=chrome
- SELENIUM=2.53.6
- python: "2.7" # For PR and cron
env:
- BROWSER="internet explorer"
addons:
sauce_connect: true
python: "2.7"
- os: linux
- BROWSER=chrome
- SELENIUM=3.0.2
- python: "3.3" # For cron only
env:
- BROWSER=safari
addons:
sauce_connect: true
python: "2.7"
- BROWSER=firefox
- SELENIUM=2.53.6
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- pip install selenium==$SELENIUM
script:
- python test/run_tests.py $BROWSER
39 changes: 3 additions & 36 deletions BUILD.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,11 @@ test/

Unit and Acceptance Tests
-------------------------
To run tests give command::

The test directory contains everything needed to run Selenium2Library
tests with Robot Framework. This includes:
python test/run_tests.py <browser>

- Unit tests under `unit` directory.
- Acceptance tests written with Robot Framework under `acceptance`
directory
- A very simple httpserver.py which is used to serve the html for tests in
`resources/testserver`
- A collection of simple html files under 'resources/html' directory
- Start-up scripts for executing the tests
- A copy of statuschecker.py for checking logged messages after the
execution, which requires the tests to run with log level DEBUG

To run unit and acceptance tests, run::

python test/run_tests.py python|jython ff|ie|chrome [options]

The first argument to the script defines the interpreter to be used
to run Robot. The second argument defines the browser to be used,
using the same browser tokens that you would use in your Robot
tests.

Due to the structure of the tests, the directory containg the test
case files (`acceptance`) is always given to Robot as test data path.
To run only a subset of test cases, Robot command line arguments
--test, --suite, --include and --exclude may be used.

Examples::

# Run all tests with Python and Firefox
python test/run_tests.py python ff
# Run only test suite `javascript` with Jython and Internet Explorer
python test/run_tests.py jython ie -s javascript

To run just the unit tests, run::

python test/run_unit_tests.py
More details in `<test/README.rst>`__


Debugging Selenium2Library
Expand Down
85 changes: 85 additions & 0 deletions test/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
Testing and debugging
=====================
Requirements
------------
Before running the test, install the dependencies::

pip install -r requirements.txt
pip install -r requirements-dev.txt


Unit and Acceptance Tests
-------------------------

The test directory contains everything needed to run Selenium2Library
tests with Robot Framework. This includes:

- Unit tests under `unit` directory.
- Acceptance tests written with Robot Framework under `acceptance`
directory
- A very simple `httpserver.py` which is used to serve the html for tests in
`resources/testserver`
- A collection of simple html files under `resources/html` directory
- Start-up scripts for executing the tests: `run_tests.py` and
`run_unit_tests.py`

To run unit and acceptance tests, run::

python test/run_tests.py <browser>

Tests are executed using Robot Framework and results verified automatically
afterwards using `robotstatuschecker` tool. The tool can be installed using
`pip install robotstatuschecker` and more information about it can be found
from: https://github.com/robotframework/statuschecker/. Notice that initially
some tests fail.

Running test with different interpreter
---------------------------------------

By default the interpreter is set to `python` and it depends on the operating
system settings, which python is used by default. It is possible to run test
by using different interpreter by using the `--interpreter` command line
argument.

Starting from version 2.0 onwards the Selenium2Library is tested by using
Python 2 and 3. Other interpreters are not tested by the development team.


Robot Framework command line arguments
--------------------------------------

It is possible to pass Robot Framework command line arguments to the test
execution as last arguments to the `run_tests.py` command. It is recommended
to use arguments to select required suite or test for the execution when
developing new functionality for the library. Example like --test, --suite,
--include and --exclude.


Using Sauce Labs for acceptance tests
-------------------------------------

When running test by using browser from Sauce labs, it is required that the
Sauce Connect is used. The Sauce Connect allows the browser from Sauce Labs
reach the acceptance test web server. The acceptance test uses tunnel with
name `localtunnel` and therefore when establishing the Sauce Connect tunnel
use the following command::

bin/sc -u YOUR_USERNAME -k YOUR_ACCESS_KEY -i localtunnel

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There probably should be an empty row after ::.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


More details and to download Sauce Connect visit:
https://wiki.saucelabs.com/display/DOCS/High+Availability+Sauce+Connect+Setup


Examples
--------

Examples::

run_tests.py chrome
run_tests.py --interpreter jython firefox --suite javascript
run_tests.py chrome --sauceusername your_username --saucekey account_key --suite javascript
run_tests.py --interpreter "py -2" chrome --suite javascript

To run just the unit tests, run::

python test/run_unit_tests.py
20 changes: 0 additions & 20 deletions test/env.py

This file was deleted.

Loading