#sauc·ey* [ /ˈsɑː-/ ] intoxicated, drunk, or under the influence
Last night we went out to celebrate and got saucey at the bar off henessy.
##What this is? Saucey is an Automation framework written in mainly PHP. Designed to kick-ass and take names.
##What it do? This framework allows testers to:
- Control most aspects of the PC, i.e open a native iOS app with Xcode's iOS Simulator, etc.
Click
,right-click
,double-click
,triple-click
&drag
via X/Y coordinates.Press any keyboard key(s)
either in conjunction or individually.iOS/Android gestures
, i.e. 4-finger swipe left/right.- Create & maintain tests for
Selenium
& headless drivers with Gherkin. - Evaluate
REST/SOAP API
endpoints with business-logic driven code. - Run
load & performance
tests. - Hook a Browser-Based Web Inspector to your app
- Assert against
Network/XHR
&console logs
,DOM
, etc. - Test UI elements with user-driven logic.
- Verify arrangement of files and directories; availability of assets.
- Set server-side, front-end and functional assertions.
- A reporting engine, with pass-fail statuses of all test cases, scenarios, and features
- Design
End-To-End
,User Acceptance
,Regression
&Functional
test suites & cases - Connect test suite(s) to a
continuous integration
system of choice. - It's a Docker & Vagrant Image. Yes. The whole damn thing.
##What's inside
##MOAR
- Find out more @ http://saucey.io
- Fork the repo @ https://github.com/withpulp/saucey.git
- See wiki
- See The Winery for more on how this framework was set up.
- See The Cellar for available functionality.
#Get Started ##Pour a glass (Init & Install) To make things simpler, we'll use Robo for all of our task management needs. Lets install it! Install all dependancies through composer, if you run in to any issues please see the wiki.
For all instances of <tag>
replace it with the tag for the test suite. For example, for my tests in features/getSaucey the tag is saucey
.
-
From the root of the project, run:
curl -sS https://getcomposer.org/installer | php
-
Then run:
php composer.phar install
Or if this is not the first time you are initializing saucey, run:
php composer.phar update
-
From here, robo takes control, run:
bin/robo init
-
For testing with Selenium
locally
:bin/robo saucey:tipsy '<tag> <browser>'
or, if you want to test with PhantomJS or Goutte (headless & lightweight)
bin/robo saucey:tipsy '<tag>'
**Note: Not all tests will work with PhantomJS, i.e. @alert
-
For testing against the
cloud
, obtain yourusername
&api-key
from https://saucelabs.com/account then set up your account with:robo saucey:connect
Answer the following two questions with the information from your clipboard, and your project should be initialized.
then, run:
bin/robo saucey:drunk '<tag> <environment> <browser>'
##Shots! (examples) ###Local w/ Selenium - Tipsy
-
Given you've installed via the below from above, Step 1.
curl -sS https://getcomposer.org/installer | php php composer.phar install bin/robo init
-
Run local examples via:
bin/robo saucey:tipsy 'form firefox'
or
bin/robo saucey:tipsy 'web chrome'
or
bin/robo saucey:tipsy 'api'
or
bin/robo saucey:tipsy 'shell'
-
Robo should be running the test suite(s), upon completion it should open a newly generated report.
-
You should see a bunch of tests that look like the below output from
api
:
Feature: SOAP & REST API Functionality
As a tester
I want to make sure api features are up and running
So that I can automate continuous integration and regression tests using it
@api @get
Scenario: Make and validate a GET request
Given send a GET request to "/comments?postId=1&id=1"
Then the response code should be 200
And the response should contain json:
"""
[
{
"postId": 1,
"id": 1,
"name": "id labore ex et quam laborum",
"email": "[email protected]",
"body": "laudantium enim quasi est quidem magnam voluptate ipsam eos\ntempora quo necessitatibus\ndolor quam autem quasi\nreiciendis et nam sapiente accusantium"
}
]
###Cloud w/ SauceLabs - Drunk
-
Given you've installed via the below from above, Step 1.
curl -sS https://getcomposer.org/installer | php php composer.phar install bin/robo init
-
To point your saucey installation to SauceLabs, you'd need your
username
andapi-key
. Sign up and register for a free SauceLabs account. Then get your username and api-key via/account.
Copy the info into your clipboard. -
Run:
robo saucey:connect
Answer the following two questions with the information from your clipboard, and your project should be initialized.
-
Run a sanity suite via:
bin/robo saucey:drunk 'form mac chrome'
-
Then, go to https://saucelabs.com/account and view your running/completed tests. Navigate through and download meta-data, screenshots and video recordings of the entire suite.
##Winery (weinre)
Open the winery
via:
bin/robo winery
Select your host and port. Adcade testers should use:
adcade.dev:7890
And add the below to your ad unit:
<script src="http://adcade.dev:7890/target/target-script-min.js#anonymous"></script>
Be sure to checkout the Browser-Based Inspector
@ http:adcade.dev:7890/client/#anonymous
####localhost testing on the cloud To test something on a localhost in the cloud, you can open a tunnel with sauce connect. With your username and api-key/access_key from the steps above, run:
vendor/bin/sauce_config user_name access_key
To start the connect tunnel:
vendor/sauce/connect/bin/sauce_connect
###Mobile & Tablet ####For iOS:
bin/robo saucey:drunk '<tag> ios_phone'
bin/robo saucey:drunk '<tag> ios_tablet'
bin/robo saucey:drunk '<tag> ios_tablet_landscape'
####For Android:
bin/robo saucey:drunk '<tag> android_phone'
bin/robo saucey:drunk '<tag> android_tablet'
bin/robo saucey:drunk '<tag> android_tablet_landscape'
On Mac OS X, (with the exception of LAMP for Windows) saucey requires the below dependancies. For now, the Pour a glass section above should cover all dependancies. However, if there are errors thrown upon running:
php composer.phar install
or php composer.phar update
...you can reference the sources below. They should also be maintained.
- XCode & Developer Tools
- Java JDK, see documentation
- Node.js & npm
- cURL
- WAMP
Windows Only
- PHP just incase, should be covered by composer.
#Reporting & MOAR
##Reporting
By default, reports are saved to the reports/
directory. If you ran a suite via saucey:drunk
or saucey:tipsy
, you can see the report in:
reports/
View real reports below:
- http://testweb.pw/adcade/Default/reports/saucey_report_web.html
- http://testweb.pw/adcade/Default/reports/saucey_report_api.html
- http://testweb.pw/adcade/Default/reports/saucey_report_shell.html
##MOAR
You can use this by adding the below alias to ~/.bash_profile
:
alias t='python ~/Sites/saucey/vendor/saucey/framework/var/tasks/t/t.py --task-dir ~/Sites/saucey/var/tasks --list tasks'
#Caveats
-
To use the
local_safari
profile, in other words to test against a local version of Safari, go to:vendor/saucey/framework/drivers
-
And install the
safari_extension.cer
-
Go
Safari
>Preferences
and make sure it is enabled.
##Selenium Issues The issues listed below are some known issues with the Selenium WebDriver.
- Firefox ≤36.0.3 does not render ANY web driver functions from selenium, fixed in v36.0.4 with selenium
- Most of the major web driver functionality, i.e. pressing buttons, following links are completely non-functional for the Safari Web Driver.
- Locally, some step definitions are non-functional:
iMoveBackwardOnePage
,iMoveForwardOnePage
,iRefreshThePage
##Saucey Issues See https://github.com/withpulp/saucey/issues
##TODO See https://github.com/withpulp/saucey/issues