Behat support for third party themes MDL-55072 #Moodle

July 12th, 2016

Moodle HQ development team is planning to make some changes in behat support infrastructure so that the test steps can be overridden by the individual themes. Rajesh Taneja is now seeking the feedback from Moodle community members about the proposed changes.

Currently the behat tests doesn’t support some external links like custom login page in a particular theme. So MDL-55072 was raised to resolve the issue. Now, Moodle HQ is planning to introduce support for 3rd party theme where theme can:

  • Override contexts and feature
  • Blacklist set of features, so they won’t be run if specific theme is set.

Behat support for third party themes MDL-55072 #MoodleTo override context/feature theme has to introduce:

  1. Override feature: Creating file at following level will use the defined feature file and remove the original feature file from behat.yml theme/themename/tests/behat/overrides /{frankenstyle}_{feature_name}.feature
  2. Override context: Creating file at following level (extending existing context is not important), will use the defined context to find step and remove the original context inclusion from behat.yml theme/themename/tests/behat/overrides/{frankenstyle}_{context_name}.php
  3. Blacklist feature/context: Creation file at following level will remove defined feature and contexts from behat.yml, so they won’t be executed. theme/themename/tests/behat/overrides/blacklist.json

If you are Moodle theme designer then this tracker issue is going to be very useful for you in coming future, so share your feedback in this forum thread or on the Moodle tracker issue page.

About Behat:

Behat is a behavioural driven development (BDD) tool written in PHP, it can parse a human-readable list of sentences (called steps) and execute actions in a browser using Selenium or other tools to simulate user interactions.For more details about Behat tests and working check out this Moodle docs page.