I have recently joined a Drupal project at work that is approx 50% finished. Functional testing was never part of the project. The site has about 8 custom modules and they are not going to be used anywhere but with this client. I tried implementing the testing module in D7 but the modules were not created in a way that allows the modules to install cleanly. I tried to get them installable but I don't think there will be enough time to devote.

So, I need a solution that will allow me to test the new features we are building without having to fix the previously built portions.

I looked at Selenium but to my knowledge it requires the feature to be built before the script can be recorded. I'd like to use it Test Driven Development style. I have also been looking at Behat but honestly, I don't get it.

This question is more specific than "what is your favorite functional testing framework?". It is more specifically, "What functional testing framework works well with Drupal and works with our site as it is currently developed?".

  • What is the exact URL of the "testing" module? I doubt you mean drupal.org/project/testing ... Commented Jun 19, 2015 at 5:43
  • @pierre I was referring to the testing module that is included in Drupal 7 core
    – zkent
    Commented Jun 19, 2015 at 16:39

1 Answer 1


I ended up working with Behat (http://docs.behat.org/en/latest/) and Mink for Behat (http://mink.behat.org/en/latest/) to write tests that emulated a user using a browser on my website.

However, I still needed Drupal integration for quick access to nodes, users, and roles. I found this project (https://www.drupal.org/project/drupalextension) which incorporates Behat, Mink, and the Drupal API. This allows me to write tests like this:

Scenario: Logged out user can access the custom Landowner registration page
    Given I am not logged in
        And I am on the homepage
    When I click "Register here"
        And I am on "/register"
        And I click "Register as a Landowner"
        And I am on "/register/landowner"
    Then I should see "Landowner Registration"

Now I can test a Drupal site without the issues involved with Simpletest.

  • I'm using ajax a lot and ctools to displays forms in dialogs. Do you know this module can handle this for testing?
    – Codium
    Commented Dec 8, 2015 at 22:34
  • 1
    @drupality, yes. I do this as well using Selenium as a browser instead of the default headless browser when I need Javascript or Ajax. I just add the @ javascript tag to the scenario to run the test in Selenium. Selenium will launch a browser and you can watch the test play out in the browser.
    – zkent
    Commented Dec 9, 2015 at 3:36
  • The only downside I see is that Behat is designed to test against your current environment, and not a fresh environment controlled by Simpletest.
    – AlxVallejo
    Commented Jan 29, 2016 at 14:32
  • @AlxVallejo why not? Although I have yet to try it with Simpletest, I don't see why it wouldn't work on a new environment.
    – zkent
    Commented Feb 1, 2016 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.