ui testing with ghost inspector
TRANSCRIPT
ui testing with ghost inspector
a capstone for your testing pyramid
jay luker | @lbjaysenior software engineer, harvard dce
about.me“self-taught”
full-stack
not a testing "expert"
free, open-source
small teams, smallish orgs
lazy
likes: python, rowing, jaywalking, mondays
dislikes: tea, endless scroll, mis-implemented http status codes
this is not that other talk●pytest
●pytest plugins
●ghost inspector
●pytest-ghostinspector
https://www.youtube.com/watch?v=qs1mbTg2kds
let's talk about...why we do automated testing
the ideal "testing pyramid"
ghost inspector
how we're using ghost inspector at dce
why write automated tests?●continuous feedback throughout the development cycle
●did this change break something?
●catch bugs earlier and faster
●help inform the writing of code and application architecture
●help specify code and application behavior
types of automated tests●unit
●integration
●end-to-end
test scope continuumsmall (unit) large (e2e)
fastcheapreliableisolatedlow test:value ratiorun frequentlyverifies code behaviorowned by developerscreated earlyshort feedback loop"are we building the system right?"
👈👈👈
¯\_(ツ )_/¯👉👈
¯\_(ツ )_/¯👉👈👈
¯\_(ツ )_/¯
slowexpensive
flakeyintegrated
high test:value ratiorun infrequently
verifies real world behaviorowned by anyone*
created latelong feedback loop
"are we building the right system?"
the testing pyramid
source: http://googletesting.blogspot.co.uk/2015/04/just-say-no-to-more-end-to-end-tests.html
pyramid vs ice cream cone
source: https://watirmelon.com/2012/01/31/introducing-the-software-testing-ice-cream-cone/
in summary...●write tests
●not too much end-to-end / ui
●mostly unit
ghost inspector●cloud-based ui testing service
●record tests
●manually build/edit tests
●execute tests
●schedule tests
●view & monitor test results
●receive notification of test outcomes
who the what now?●it's like a browser*...
●in the cloud…
●that accesses your site…
●and does stuff…
●and verifies everything worked right…
●and then lets you know if it didn't* more specifically, a headless browser under the control of a webdriver
great things about ghost inspector●free / cheap
●easy to get started
●high initial effort:value ratio
●well-written documentation
●intuitive interface
●api for running tests
●nothing to install locally
●tests allow custom variables & re-use
●helpful support
not so great things about ghost inspector●slow, particularly on failures
●missing concurrency
●no test versioning
●documentation can be shallow
●test recorder tries hard but has limitations
●tests run remotely; firewalls / access control require hoop-jumping
●support is currently via e-mail only
things you will need●a website or web application to test
●chrome (optional)
●knowledge of html and javascript
●knowledge of how to use chrome or firefox developer tools
●knowledge of how to interact with restful apis (optional)
●$$ for > free pricing tier (optional)
free tier details●100 tests / month
●3 tests * daily schedule: boom
●all the bells & whistles
●link a (free) runscope account* and get 500 tests / month
* https://www.runscope.com/ghostinspector
let's do this thing1.create a ghost inspector
account
2.install the chrome extension
3.login through the extension
4.record a test
5.edit the test steps
6.execute the test
7.view the results
8.repeat 5-7 as needed
9.set schedule & notifications
demo!
test creation & editing tips●adjust css selectors to be less brittle
●adjust css selectors to remove transient values
●chrome / firefox developer tools are your friend
●use variables for transient values
●remove unnecessary form input 'click' steps
●something not working? drop down to javascript
●start urls can contain variables!
●try changing the browser version
●create a "library" suite of reusable snippets
ghost inspector at dce●dev team of ~10, including 2 full-time qa'ers
●cluster application on aws opsworks
●more ice cream cone than pyramid
●e2e testing objective is to validate production releases
test automation tools●mh-opsworks: command-line cluster manager
●mh-ui-testing: command-line ui testing tool
●pytest-ghostinspector: pytest plugin for the ghost inspector api
https://github.com/harvard-dce/mh-opsworks
https://github.com/harvard-dce/mh-ui-testing
https://github.com/harvard-dce/pytest-ghostinspector
thanks!●email: [email protected]
●slides: http://bit.ly/ui-testing-with-gi