"PYRO" is a suite of several tools, which provide integrations between Teamcity, Sauce, Robot Framework and Selenium.
Pyrobot is a python script which wraps the robot framework toolchain provided by 'pybot'. It is the executionary step that pulls in PyroFramework and starts the tests that pull in the PyroLibrary. This component serves as the entry point to the suite, which houses the testcode and the archived results of the suite.
The PyroLibrary is a web testing library for Robot Framework that provides Sauce Integration, Browser Capability testing and Custom xtendable Selenium2Library methods.
PyroFactory is a python wrapper that provides integration between TeamCity's Sauce CI Plugin and PyroBot. The tool intersects the Sauce CI environment variables for Single and Multiple Browser tests, and creates a series of payloads to run against these vectors . The factory can also run standalone outside of teamcity (cmdline), where it can instantiate a local browser, or even direct the payload test code to a remote Sauce browser of your choosing. Once tests are executed, the results are concatinated by rebot to provide aggrigated results in a single log and report.
- Intersects Teamcity/Cmdline information to determine which browsers to run on; such as, local or remote (Sauce)
- SAUCE_ONDEMAND_BROWSERS (Multiple Sauce Browsers), SELENIUM_DRIVER (Single Sauce Browser), and BROWSER (CmdLine execution of Local and Solo Sauce Browser) environment variables are intersected
- Can be executed through Teamcity or Standalone on the commandline
- Spawns pybot processes in serial
- Stages each pybot test suite with the target browser
- Browser information is embedded into log
- Concat pybot's resulting output and reports
- TODO Teamcity tab captures the resulting testcode data, which provides a single glance update of the suite execution
- Both library and factory are installed through pip
- A Teamcity build is started, and as such invokes; Sauce CI - Plugin and Pyrobot, the build feature and build step respectively.
- Teamcity will start OnConnect (if selected)
- Pyrobot executes the payload, either a single file or entire directory
- If a directory is provided, the directory contents can be enumerated to allow the files to be ordered.
- __Example Enumeration
- The results are placed into workspace under the pyrobot project eg:pyrobot/workspace under a unique folder, after which the files are consolidated into a single report if multiple browsers were selected in build features
- The unique folder under workspace is randomly created unless the WORKSPACE_UID is specified on the command line (allows TeamCity to Atrifact reference)
- TODO Sauce REST API integration to show results under 'Sauce Results' tab in teamcity build
- The SauceCI plugin provides environment variables, which execute multiple or single browsers based on the Suace CI Plugin selection within the build feature.
- These environment vaiables are intersected and intrepreted to provide a remote selenium webdriver instantiation to robot framework
WORKSPACE_UID=WEEKLY_DEV_SM_%env.BUILD_NUMBER% BASE_URL=http://10.10.9.63 PAYLOAD=/mnt/wt/pyrobot_v1.1/pyrobot/dev/spec/02__pyrobot_library.txt python /mnt/wt/pyrobot_v1.1/pyrobot/pyrobot.py
- Pyrobot can be executed from the commandline, using ant, or directly with the python script itself. When in standalone mode, the browser object is created based on the default values in ./PyrobotConfig
- Display Buffer:
vncserver :60 -geometry 1280x1024
orXvfb ...
BROWSER='chrome' BASE_URL=http://10.10.9.63 PAYLOAD=/mnt/wt/pyrobot_v1.1/pyrobot/dev/spec/02__pyrobot_library.txt python /mnt/wt/pyrobot_v1.1/pyrobot/pyrobot.py
BROWSER='Linux,chrome,32' WORKSPACE_UID=WEEKLY_DEV_SO_%env.BUILD_NUMBER% BASE_URL=http://10.10.9.63 PAYLOAD=/mnt/wt/pyrobot_v1.1/pyrobot/dev/spec/02__pyrobot_library.txt python /mnt/wt/pyrobot_v1.1/pyrobot/pyrobot.py
- Pybot is executed for each payload specified, and all selected browsers in the Build Feature in Sauce CI.
- The Selenium2Library is augmented to provided integration to the Sauce service (see Pyrobot Robot Framework)
SAUCE_USERNAME = "yourname"
SAUCE_ACCESSKEY = "yourkey"
DEFAULT_SAUCEURL = "sauce-ondemand:?username=%s&access-key=%s&os=Windows 2012 R2&browser=%s&browser-version=11&max-duration=null&idle-timeout=null"
- when executed in standalone, this remote webdriver is instanciated if using sauce
DEFAULT_SOLO_BROWSER = 'firefox'
- when executed in standalone, this remote webdriver is instanciated if using local browser
DEFAULT_BROWSER_DISPLAY = ":60"
BASE_URL = "http://www.google.ca"
- when not provided through ant/python, base_url default here
WORKSPACE_HOME = "/mnt/wt/pyrobot_v1.1/pyrobot/workspace/"
- Reference the resource file:
Resource ../resources/resource.txt
- Various Invocations:
Open Pyrobot http://www.google.ca __Local Default Browser TestLevel URL__
Open Pyrobot http://www.google.ca chrome __Local Non-Default Browser TestLevel URL__
Open Pyrobot ${PYRO_BROWSER} http://www.google.ca __Sauce Browser TestLevel URL__
Open Pyrobot ${PYRO_BROWSER} __Sauce Browser BaseUrl URL OnConnect__
* above this base_url is OnConnect only
- TODO