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.
I am just getting started testing a new Redhen CRM instance using Behat. I'm using the Drupal API. While writing tests is coming along nicely, I don't see how to write tests that target the CRM's native objects, contacts, orgs, and lists.
The only connection that has turned up between Behat and Redhen from searches is three extremely basic tests that were the result of a sprint on Redhen Raiser. These tests don't target anything unique about the CRM but test basic things like logging in to Drupal.
I would like to be able to write a test along the lines of:
I have open an issue on Github, but this is maybe a better place to discuss this.
I have setup around twenty scenarios, all run fine when I run them directly and independently.
However, when I run my test suite in my CI pipeline (or locally), some of them randomly fails.
The screenshot taken when the test fails shows me that the user is considered as anonymous despite the fact that the authentification step was marked as successful.
Can someone give me some hints to try to debug this ?
I have no idea where to search as each time the failing tests differs.
PHP Fatal error: Undefined class constant 'Symfony\Component\DependencyInjection\ContainerInterface::SCOPE_CONTAINER'
We like to test Organic Group and their Content but are puzzled how to create related content.
Reading http://www.grasmash.com/article/behat-steps-organic-groups gives some clues but it's for Behat 2 and we did not manage to get that translated to Behat 3 yet.
Thinking about this basic need makes us wonder whether every site team has to add these steps themselves to their own context?
What would be the best way to share steps through the contrib modules?Read more
We had some trouble using the Drupal Extension for Behat as scenarios aren't isolated from each other/what's already there, leading to sporadic failures. To counter this, we've put together an extension which causes each scenario to be run on a fresh install, leading to consistent (but slightly slower) builds. We've released it at https://github.com/elifesciences/isolated-drupal-behat-extension.Read more
I can't seem to login as an admin on behat tests. Could anyone help point me in the right direction?
I'm trying to log create a scenario with a by logging in as a user in the administration role. I'm using the following as my first run to get my feet wet
$ cat first.feature
Playing with features and exploring
Scenario: Run cron
Given I am logged in as a user with the "authenticated" role
When I run cron
And am on "admin/reports/dblog"
Then I should see the link "Cron run completed"
However, on this I can't seem to get past the first step. When running this feature, I see the following error:Read more
I need to find a way to create a list of all tests available for non technical gherkin test writers.
What are others using for this?Read more
Forcontu is offering 10 x Training Scholarships for the Expert in Drupal 7 online course (valued at USD1350). If you want to apply, complete the form before April 15, 2015. On April 16 we will announce the 10 winners of a scholarship to join the course completely free. The course will be conducted from May 4 to December 4 (7 months).
More information and registration at:Read more
Promet Source will be conducting a full day of training at Drupal MidCamp next week for Behavior Driven Development with Behat.
This training workshop is designed to help developers get started with the process of behavior driven development (BDD) in PHP using the Behat toolkit with Drupal specific extensions in order to align technical testing with business expectations when using Drupal as a development platform.
We will be focusing on Behat 3, and the latest version of the Drupal Extension for Behat in our workshop.Read more
When we started out using behat, things were great. Tests were easy to write and ran quickly. And then...over time, we got up to tests that took an hour to run. Which is too long.
We tried a few strategies:
- Throwing more hardware at the problem - this cut test speed in half, but was constrained by CPU speed.
- Reducing steps in afterScenario - we had placed a handful of different test cleanup steps into the afterScenario and those ran every time, even if they weren't needed. Optimizing those cut 30% off the test time for us.
So I'm working with the new Behat 3.0 (and the latest Drupal Extension), and discovering how much has changed... For example, Metasteps? Gone. Lots of changes to how you call stuff, and so on.
So a lot of the existing (and awesome) code out there you'll find googling no longer works.
One example: take a screenshot when a step fails? The code is obsolete. I know it's doable, but I'm not sure how yet.
Is there a good place (yet?) to discover the 3.0 way of doing things, and a repository of good example code for doing 'all the things'?Read more
Hi, I have set up a drupal structure using composer in git to kickstart our drupal development.
In the setup, behat and the DrupalExtension is integrated.
Our team will soon start writing tests for our websites. The generic tests (administrator permissions, Check if homepage works ...) will be put in our main git repo. I was wondering if there are other who have generic tests that are used on every drupal site, and if we could create a main repository ?Read more
We are arranging for a Google hangout session where Drupal experts who have built the curriculum for Acquia certification and Drupal Developer who have taken the test will come on the same floor to talk on all you need to know about Drupal Acquia certification program. This will be an interactive session, you can ask questions and clarify your all your doubts.Read more
On Tuesday, October 28 we'll meer for another Dinner with Drupal. Between 17:30 and 18:30 a number of stand-up presentations will be given, after which we will have dinner and drinks at the venue. There are open spots for those who will want to demonstrate interesting new technologies or services, or who will want to pitch ideas. Please contact us, so we can put you in the schedule.Read more
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