BeEdit - a Drupal 8 Behat Editor

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
jchin1968's picture

As part of my Drupal 8 self-learning, I created a module called BeEdit which is a Behat editor suitable for non-technical users. It allows someone to create, edit and run Behat tests from the Drupal web application. You can get it here: https://www.drupal.org/sandbox/jchin1968/2829843

The installation for BeEdit is very straightforward (assuming you already have Behat with the Drupal Extension already working on your system), just download the module, enable it and set two paths in the settings page. Creating and running feature files should be equally straightforward as I tried to make the process similar to creating node content. Full instructions can be found in the README.md file.

I hope you will find this project useful. Please let me know if you encounter issues or have features you would like to see. Once the Drupal 8 version of BeEdit is stable, I'll backport it to Drupal 7 if there's enough interest for it.

Comments

It looks like a great

rodrigoaguilera's picture

It looks like a great functionality.

Do plan or are you applying to make it a full project instead of a sandbox?

Thanks. Yes, the plan is to

jchin1968's picture

Thanks. Yes, the plan is to promote it to full project status after some feedback from users on what needs to be improved, bug fixes, etc.

Very interesting start...

justinlevi's picture

This module has great potential. I'm still checking it out, but did notice a few issues out of the gate.

<

ul>

    1. Default values for bin and feature paths. This is probably not a great user experience and could be improved by requiring those settings or by providing reasonable defaults. The defaults could be validated to ensure the behat executable can be reached and exists and that the features folder exists as well.
    2. The "Configuration" > "Development" > "BeEdit" page throws an error

    If you visit this page before configuring your behat paths.The edit screen throws an error on the theme hook function. I believe you need to also include the variables array.

Here's a screen grab:
https://www.drupal.org/files/issues/Edit%20Screen%20Bug.jpg

The following patch should fix the issue:
https://www.drupal.org/files/issues/0001-variables-required.patch

Thanks for the feedback

jchin1968's picture

Thanks for the feedback justinlevi. I'm embarrassed to have missed the error since it's such a glaring one. Changes have been committed.

@jchin1968 Also, in my case I

justinlevi's picture

@jchin1968 Also, in my case I need to pass along some additional config settings to get my behat tests to run.

example:
../../vendor/bin/behat --config=local.yml -p local --colors 'features/homepage.feature'

There is probably a more user friendly way to handle this situation but I went ahead and added an additional text field to save additional config settings.

Commit is here:
https://github.com/justinlevi/BeEdit/commit/35b6e0b043c0eb3218bd3fc638da...

Which looks like this on the settings edit screen:
https://www.drupal.org/files/issues/Screen%20Shot%202016-11-23%20at%2012...

Here's the Patch : https://www.drupal.org/files/issues/0001-custom-config-settings.patch

Good catch. Thanks. The

jchin1968's picture

Good catch. Thanks. The change has been committed.

What about Behat UI module?

Rajab Natshah's picture

What about Behat UI module?
I think the UI/UX could be Upgraded with better management too Drupal 8

Run Test
https://www.drupal.org/files/issues/Behat-UI-working--run-test.png

Create Test
https://www.drupal.org/files/issues/Behat-UI-working-create-test.png

Rajab Natshah
rajab.natshah.com

Yup...

justinlevi's picture

yeah, that module had great promise as well. Would love to see that get incorporated/ported.

I did look into the Behat UI

jchin1968's picture

I did look into the Behat UI and Behat Editor (https://github.com/alnutile/behat_editor) modules but I wanted a simpler user interface for creating and editing features.

Both of them used select and auto-complete fields with predefined step definitions for creating scenarios. This is fine when you're a beginner just starting out but I think it will get a bit cumbersome after a while. It also restricts you from creating undefined step definitions which kind of defeats the BDD principle of creating tests first.

There were some features from Behat UI and Behat Editor that I liked and will try to implement into BeEdit such as using the Behat HTML formatter (https://packagist.org/packages/emuse/behat-html-formatter), exporting feature files as a download, running multiple feature tests at once and better integrating Selenium driven tests.

Sorry, this was not meant to

jchin1968's picture

Sorry, this was not meant to be a new comment but a reply to RajabNatshah question "What about Behat UI module?"

Rajab Natshah's picture

Rewarded work and ideas you have.

I'm very into having Automated Functional Testing and the BDD and TDD in software development.

I worked on building the Varbase Behat for the Varbase profile. Enjoyed every bit of it. ( Drupal 7 and Drupal 8 )

But when we came to the point of haring an automation testers for the company. to continue helping on writing more Gherkin Features. we do face number of needs and a training carve for them.

Any good tool will help in the UI/UX and management

- New Gherkinars is a prob. they do have some needs.
-- No complication of back-end or command lines.
-- They do not know all definitions and all the variations.

- Intermediate and expert Gherkinars needs.
-- Have some basic installation tools.
-- BeEditor to write and save Gherkin Features in files or a custom entity storage.

Any good work or tools and flow will help us all.
I'm using the emuse/behat-html-formatter in both Drupal 7 and Drupal 8.
This is a report example for a new issue https://www.drupal.org/node/2830057

We all can work on tools which could help our-self and others.
I do have a system of Behat and Gherkin Feature Manager for products and projects.

I will put the Cucumber profile out soon.

We all should use "Cucumber" as a guide. to build Testing Management tools, and Automated Functional Testing Tools.

And Manage Gherkin Features with number of Status and used platforms.

Gherkin Feature Status:
- Pseudo Cod
- To Implement
- Implemented
- In Progress
- Needs Work
- Needs Definitions
- Needs Review
- Buggy

Some time the same feature will need some tagging for Scenarios, to run them in @local, @development, @staging, @production .. and if they are @check or @init which could change the database and files or @cleanup.
Add Behat tags selector to the "Run Tests"

I think we could open new threads for many other points.

Rajab Natshah
rajab.natshah.com