22
ui testing with ghost inspector a capstone for your testing pyramid jay luker | @lbjay senior software engineer, harvard dce

Ui Testing with Ghost Inspector

Embed Size (px)

Citation preview

Page 1: Ui Testing with Ghost Inspector

ui testing with ghost inspector

a capstone for your testing pyramid

jay luker | @lbjaysenior software engineer, harvard dce

Page 2: Ui Testing with Ghost Inspector

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

Page 3: Ui Testing with Ghost Inspector

this is not that other talk●pytest

●pytest plugins

●ghost inspector

●pytest-ghostinspector

https://www.youtube.com/watch?v=qs1mbTg2kds

Page 4: Ui Testing with Ghost Inspector

let's talk about...why we do automated testing

the ideal "testing pyramid"

ghost inspector

how we're using ghost inspector at dce

Page 5: Ui Testing with Ghost Inspector

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

Page 6: Ui Testing with Ghost Inspector

types of automated tests●unit

●integration

●end-to-end

Page 7: Ui Testing with Ghost Inspector

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?"

Page 8: Ui Testing with Ghost Inspector

the testing pyramid

source: http://googletesting.blogspot.co.uk/2015/04/just-say-no-to-more-end-to-end-tests.html

Page 9: Ui Testing with Ghost Inspector

pyramid vs ice cream cone

source: https://watirmelon.com/2012/01/31/introducing-the-software-testing-ice-cream-cone/

Page 10: Ui Testing with Ghost Inspector

in summary...●write tests

●not too much end-to-end / ui

●mostly unit

Page 11: Ui Testing with Ghost Inspector

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

Page 12: Ui Testing with Ghost Inspector

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

Page 13: Ui Testing with Ghost Inspector

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

Page 14: Ui Testing with Ghost Inspector

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

Page 15: Ui Testing with Ghost Inspector

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)

Page 16: Ui Testing with Ghost Inspector

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

Page 17: Ui Testing with Ghost Inspector

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

Page 18: Ui Testing with Ghost Inspector

demo!

Page 19: Ui Testing with Ghost Inspector

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

Page 20: Ui Testing with Ghost Inspector

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

Page 21: Ui Testing with Ghost Inspector

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

Page 22: Ui Testing with Ghost Inspector

thanks!●email: [email protected]

●slides: http://bit.ly/ui-testing-with-gi