Behat

Events happening in the community are now at Drupal community events on www.drupal.org.

Given the interest shown at Drupalcon Portland with both a crowded session and BOF, the next step of fostering a growing use of Behat is to have a group of interested users/developers/etc. Behat, if embraced by enough Drupal folks, has the potential to vastly improve the way we test Drupal websites.

Behat IS NOT unit testing nor a specification testing tool. Behat is a Scenario-oriented BDD framework with functional testing capabilities as part of a communication process between stake-holders and developers. Behat was created and is evolving as an agile planning and functional testing methodology. However, if you want to use it as unit testing or spec testing tool, you can, but keep in mind, that it wasn't intended to do ideologically. http://groups.drupal.org/unit-testing is a better place for discussion of unit-testing. Yes, there is some overlap, but that is because of the spectrum in the testing pyramid with the various types of testing: unit tests (base), functional/acceptance tests (middle), (G)UI tests (peak)

Behat was created to address black-box like, functional, user-observable behavior testing.

greggles's picture

Contributing behat tests to drupal.org?

Hello!

I'd like to start contributing some '.feature' files to modules on drupal.org and I'm trying to figure out if there's a standard way to do that so that they will be picked up when I run bin/behat to run my custom tests.

I see this documentation on subcontexts but it wasn't clear how to take advantage of that to run tests in a .feature file in a contrib.

Is there an example of a contrib module that has tests already and how to run them?

Read more
churel's picture

I just create a new module Merlin: Automatic Site builder and tester from a spreadsheet

Hello everyone,

I want to introduce you a new project I worked on : Merlin.

https://drupal.org/sandbox/churel/2160815
The global goal is to build automatically drupal components (content type, taxonomy, field etc...) and their BDD tests.

Read more
acouch's picture

Example or examples using Zombie?

I've seen some discussion of and generic examples of using Zombie with behat. I haven't seen any examples of using it with the drupalextension. Has anyone had any success with Zombie and the drupalextension? If so can you share a gist? Thanks!

Read more

Getting started with Behat and Drupal: Resources Wiki

Here are a few things that are helping me get started:

Read more
pp's picture

Starting to use Drupal Extension is easy

Hi,

I made a little starter kit which help you starting Drupal Extension

https://github.com/tanarurkerem/DrupalExtensionStarterKit

I will be happy from your feedback.

Read more
VenDG's picture

Attempting Blackbox Driver Test

I have installed Behat on my pc and I am using the feature from the blackbox driver page @ http://dspeak.com/drupalextension/blackbox.html for my first Drupal site test.

Scenario 7 is failing:

Scenario: Error messages
# features\drupalcontext.feature:35
Given I am on "/user"
# FeatureContext::visit()
When I press "Log in"
# FeatureContext::pressButton()
Then I should see the error message "Password field is required"

Read more
yurtboy's picture

Some helpful Behat custom steps we have

Just wanted to start sharing some of the hurdles we have come across testing sites and some solutions to dealing with things like Alerts, New Windows, Duplicate Classes etc. Feel free though to let me know if there are better ways!

Read more
yurtboy's picture

Behat UI for writing tests and centralizing results

Hello just joined the group, and I wanted to share some links of a module I've been working on for a few months for a company who is creating a testing workflow for their many Drupal sites.

The tool is "easy" for non technical people to build tests but also allow others to upload tests and run them via the Saucelabs extension or local Selenium2 server. Cenatralizing reports in one pace

You can see a few demos here of it in action
http://www.youtube.com/watch?v=rX3_2yift2k
and on Saucelabs
http://www.youtube.com/watch?v=d0uNC88wRvU

The install uses Composer Manage module to automate most of the setup.

The latest module now brings in Github integration so you can build and manage tests in a repo.

Here are some of the modules
The main module
https://github.com/alnutile/behat_editor
this includes a module for tagging limitations, library installation.

Read more
pbuyle's picture

Steps for Drupal form elements visibility

Hi,

I started using Behat for Drupal, my first scenarios involved verification of form element visibility (implemented through #states). I could'nt find an existing way to easily check the visibility of a form element. So I wrote a couple or steps to check for the (in)visibility of form element identified by their labels. This heavily relies on the default Drupal markup for form elements.

The code can be found at https://gist.github.com/pbuyle/7698675

Read more
marcus_clements's picture

Using Behat, Mink, Drupal Extension to regression test a D7 multisite

In my last role we used a comprehensive suite of functional tests written in Cucumber using Capybara and Selenium to help discover regression errors.

In my new role I am working with a D7 multisite with 40+ sites and I want to use Behat and Mink for the same job. My plan is to write a set of tests that check the key functionality of all the sites which will run on our dev and staging servers after deploying a release candidate.

I've got some basic tests running fine using the Goutte driver.

Read more
christophernies's picture

Access denied when attempting to create a node. Sort of.

Hi everyone! I'm a QA Engineer working on a local copy of Drupal 7.22. I'm trying to learn Behat (I have no PHP or BDD experience) - we've got it up and running with the Drupal Extension, and I am using the drupal driver (as opposed to drush) so that I can utilize steps for creating nodes. However, I'm not able to create nodes using the Drupal Extension step definitions.

Read more
frank ralf's picture

Blogpost: "Installing the Drupal Extension for Behat"

I've already posted this link elsewhere but as it is not only relevant for Windows users I post it again: http://comm-press.de/en/blog/installing-drupal-extension-behat

Read more
sethcohn's picture

Continuing the Behat discussion from Prague DrupalCon

If you attended any of the Behat related sessions, especially the long session
(video here - https://prague2013.drupal.org/session/behat-contrib)
and want to continue the discussion(s), have questions, or would like to help with the ongoing efforts, this discussion thread is meant to act as a starting point... feel free to add comments, and then split off into new discussions/etc as needed.

Read more
eliza411's picture

Behat + Drupal Extension on a Vagrant box

Start: 
2013-09-18 (All day) - 2013-09-19 (All day) America/Los_Angeles
Organizers: 
Event type: 
User group meeting

Hey there,

If you're coming to Prague next week, sdboyer, tayzlor, tizzo and I hope to see you at https://prague2013.drupal.org/session/behat-contrib (or one of the other great Behat sessions: https://prague2013.drupal.org/search/node/Behat!)

We're going to use a Vagrant box during our presentation with Behat/Mink/DrupalExtension + Drupal 7 and Drupal 8 pre-installed and running ... along with some basic examples of using the Drupal Extension with contributed Drupal modules.

Read more
eliza411's picture

Module of the month

As I prepare for the Behat + Contrib lab in Prague, I've been kicking around the idea of choosing a module each month that has tricky bits to test and working together in a sandbox to create and review some custom step definitions.

I'm thinking of Media module at the moment, but we could run a poll each month to choose the module for the next, or take turns choosing and managing the sandbox.

I'd love to know if anyone else is interested.

Read more
kim.pepper's picture

Blog post: Using Behat and DrupalDriver? Beware pathauto.

People might be interested in this recent post by larowlan http://previousnext.com.au/blog/using-behat-and-drupaldriver-beware-path...

I goes through some of the issues using the Drupal driver.

Kim

Read more
PseudoNimh's picture

Setting up Behat on Windows

A lot of current installation instructions for Behat seem to imply that a user is either using a flavour of Linux or OSX. However, not all developers have that options and some are using Windows.

Read more

Behat Examples and Snippets

This is a wiki page for Behat examples and snippets that might be useful to other people building Drupal sites. Add yours here!

Read more
moonray's picture

Behat installation and paths

I've been reading up on Behat and how to use it with Drupal. Every writeup seems to make assumptions about where to install Behat and put its configuration files, but nowhere is it definitively stated.

A. From what I gather there are 2 ways to install Behat:
1. Locally (with the binary in [drupal_root]/bin)
2. Globally (one system-wide installation of Behat in /usr/local/bin)

The first seems to be the preferred method (though never definitively stated). Aside from possible version conflicts between projects, are there downsides to a global Behat install?

Read more
tunic's picture

Which behat module to use?

There are several modules in Drupal.org about Behat:

  • behat: Last commit 25 weeks ago. It allows you to write feature tests for a Drupal site using SimpleTest API functions and assertions in step definitions.
  • behat_testing: Last commit 15 weeks ago. Integrates behat with drush and adds own step definitions for Drupal.
  • drupalextension: Last commit 1 week ago. Provides a DrupalExtension with Drupal step definitions.
  • doobie: Last commit 1 week ago. It seems to be used to test Drupal,org site with behat.
Read more
Subscribe with RSS Syndicate content

Behat

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: