Add Automated Testing to Your Project in an Afternoon Michael Sherron, Technical Architect
About Me →Michael Sherron →Drupalist, 6 years →Technical Architect, Acquia →‘Raised’ in small Drupal Shops
Testing protects you from fail →Most people know the benefits of Test automation →Small shops often overworked →Some clients won’t pay for it
What is Wraith? →Visual Regression Testing tool →Automates comparing screenshots of pages across different environments →If screenshots are different, an error is triggered →Provides nice gallery to view screenshots →Easy to implement
Isn’t this for theme testing? What can Wraith do? →Can crawl an entire site out of the box →Can test responsively →Will report an error if: elements are missing or broken on the page WSOD Default red error text is displayed
Wraith != Behat →This is an MVP testing solution. →Great for simple sites with mostly anonymous traffic. →You really should learn Behat or similar. →Doesn’t handle: Authenticated users Transaction-based tests (user signup, cart checkouts, etc)
… But if you have Behat, Wraith is still great! →Visual Regression testing will catch things Behat can’t. →Page elements moved/changed unexpectedly
Requirements →Can be run locally or on a remote server. →Root/Sudo access. →At least one production and one test environment. →Familiarity with package managers: Apt-get Homebrew →Dependencies: Ruby ImageMagick PhantomJS NodeJS NPM sudo apt-get install ruby-full
How to install and configure →Run `wraith setup` →Edit configs/capture.yaml →Optional: edit configs/spider.yaml
Unleash Ghost Army
Automation →Can add to test servers crontab, run nightly →Add as post-deploy shell script to Jenkins →Failures can trigger an
.. But what about dynamic content? DevProd
Questions?.. And Many Thanks →BBC →DrupalVM →Phase 2 →Mark Sakurada, Acquia
References →Wraith: →Awesome Vagrant Env, DrupalVM: →Phase 2: →Mark Sakurada, Acquia