Thanks for coming to Drupalcamp London 2017.

Videos will appear here within a few weeks.

See you in 2018!!

Drupal loves Behat for automated functional testing

Track: Coding and Development | Skill level: Intermediate
soumyajit.basu

Co-speaker: shikha140791

Problem Statement : Suppose you build a site, it works great, the client loves it, you launch it, and the client still loves it. Yay! Now life goes on, and six months later, the client comes back to you saying they see a red box when they are logged in, with a message about security updates. You look and see that Drupal core, ctools, rules, views, commerce, date, and a handful of other modules have updates available. Some are security updates, and others are bugfix/feature updates.

So you want to update this code to resolve security issues and improve the functionality of the site. But how can you be sure that these code updates will not hurt or break any of the existing functionality? You could revisit all of your feature work from six months to a year ago and confirm that those features still work as intended. But that can be time consuming and disrupt your other work.

So how do you make updates, whether updating contribution code or doing new custom work, with confidence that you’re not breaking essential functionality and without wasting countless hours doing a bunch of manual testing?

Why Behat?  - Behat is a Behaviour Driven Development (BDD) tool which is used to test the behaviour of the application from end user’s point of view. It’s a popular open source tool for automation testing of business cases, using human readable scenarios to map onto the PHP framework.

Behat was inspired by Ruby’s Cucumber project. Both Behat and Cucumber are based on BDD. That’s the only similarity. Cucumber supports many languages (Ruby, Python, Java etc.) but Behat is just supported by PHP.

We use Gherkin, a language quite like English, to write various scenarios/features for testing an application. Behat can also be extended by writing custom PHP functions.

The advantages of using Behat:

Unit testing- This tests that a small piece of code, a function, behaves as expected.

Integration testing- These combine several Unit tests in logical groups, to ensure that they work together properly.

System testing - This tests the system as a whole, and is mainly code oriented, but starts to touch how real people would use the system.

Behavioral testing/Acceptance testing/Customer testing- This involves clickthroughs, user behavior. This is what we are mainly interested in, and what I am talking about today. You will also hear this referred to as BDD or Behavior Driven Development.

Key takeaways for the audience -

  1. Background of what behat is

  2. How does it help when implementing a drupal based application.

  3. Setting up Behat on your machine.

  4. Writing a Behat script for functional testing.

  5. Writing your own custom scripts in Behat.

  6. How to execute Behat functionalities.

  7. Executing Behat using continuous integration. (Jenkins and Probo)

  8. Look out for the wonderful reports generated using Emuse Plugin after Behat tests have finished execution.

Slides
BEHAT.pptx2.84 MB

Keynote Speakers

Matt Glaman

Matt Glaman

(Saturday keynote)

Matt Glaman is a developer at Commerce Guys. He is an open source developer who has been working with Drupal since 2013. He is author of the Drupal 8 Development Cookbook, maintainer of ContribKanban.com, and lover of Irish Whiskey.

Twitter: @nmdmatt

Jeffrey A 'JAM' McGuire

Jeffrey A. "jam" McGuire

(Sunday keynote)

Jeffrey A. "jam" McGuire—Evangelist, Developer Relations at Acquia—is a memorable and charismatic communicator with a strong following at the intersection of open source software, business, and culture. He is a frequent keynote speaker at events around the world. He writes and talks about technology, community, and more on weekly podcasts and as a blogger on dev.acquia.com. This all helps satisfy his inner diva, which he also feeds with performances as a storyteller and musician.

Twitter: @horncologne

Danese Cooper

Danese Cooper

(Sunday closing keynote)

Danese Cooper currently serves as chairperson of the Node.js Foundation. She also works in an open source role at PayPal. Previously she was Director of the Open Source Hardware Association and CTO of the Wikimedia Foundation. She had brief stint at the Bill & Melinda Gates Foundation as a consulting open source strategist. She has been involved with open source since 1999.

Twitter: @divadanese

CxO Day Speakers

Sarah Wood OBE

Unruly Co-Founder (CEO)

Sarah Wood

David Axmark

Co-founder of MySQL

David Axmark

Ben Finn OBE

Co-Founder of Sibelius and CEO at Stealth Poker

Ben Finn

Barney Brown

Head of Digital at Cambridge University

Barney Brown

Professor Andre Spicer

Professor of Organisational Behaviour at Cass Business School City, University London

Andre Spicer

Paul Reeves

Reevo UN Limited

Paul Reeves

Sponsors

Diamond

Drupal apprentices

The best people to train new developers are developers

The Drupal Apprenticeship Scheme will be running a London intake in March. If you are interested in hiring an apprentice or know someone who would benefit from the scheme please get in touch via the link below.

  • Created and run by experienced developers
  • Teaches core skills and best practice
  • Extensive support for businesses and teams

We are also really keen to hear from people who might be interested in mentoring, training and helping us to develop and review training materials to make sure they stay absolutely current and relevant.

Find out more

Join the Drupal Association

The Drupal Association unites a global open source community to build and promote Drupal.

The Association is a not-for-profit organization that relies on individuals and businesses to fund everything they do for Drupal — from drupal.org to DrupalCon and community programs.

Connect with us and support our mission-driven work.

Support the Drupal Association