Logo

PRODUCT SUPPORT DOC

Newsletter June, 2022

 

BDD / Gherkin Editor


Host

A few words from our CEO

"We are in a transition period in between versions 7 and 8.

We've just delivered version 7sp5 which contains various maintenance patches and the 8beta is on the launch pad.

You'll find below a few highlights about those 2 releases. No doubt the embedded Gherkin Editor and its associated Step Definitions catalog is one of the game-changing features of the version 8."

- Eric Gavaldo 

NEWS

7sp5: Improved caching

Something you've all experienced with web application is that after an update, you may have to clear your browser's cache to work around various issues. This is because browsers (all of them) sometimes fail at updating some specific javascript code that have been updated and that are required for the application to work properly.

A simple solution to fix that is to minify but more importantly version all the js files (including third-party libraries) at each update. This can be done for example by adding a version in the name of the js file either statically or dynamically. This is what we're now doing.

That way, after an update has occurred server side, the browser detects only brand new javascript references and download/update it locally in its cache.

No risk anymore to run a mix of old and new code from the cache storage after an update!


8beta: BDD support and Gherkin Editor

Usually, BDD is not directly supported (or not fully supported) within ALM. Developers implements Step definitions in their own repository (Git, SVN etc.) and some more-or-less-external contributors write the .feature files using the Gherkin syntax. These .feature files contains one or several Scenarios referencing those Step Definitions.

The goal is:
  • The developers build bricks (Step Definitions)
  • The testers build walls (.feature files) using those bricks using the Gherkin syntax (Given, When, Then)

With this methodology, your new tests are de-facto automated and ready to be executed (if they do not require any new 'Step Definitions'). If they require new 'Step Definitions', when the developer implements them then the new test scenarios become automated/runnable instantly.

While it sounds reasonable that the developers build the 'bricks' in their factory, it's arguable to have the testers to build their 'walls' there too.
Indeed, the business analysts or testers are going to design those scenarios. So, doesn't it make more sense that they use a Gherkin editor right from their beloved ALM's IDE (where the test scenarios aim at being)?


The Step Definition Catalog in XStudio
While it is possible to create, delete some step definition references (what I call 'bricks' above) from the Gherkin editor itself, It can be more handy/easy to manage all of your step definitions from a centralized catalog.

It's then easier to:
  • Create new step definitions
  • Delete existing step definitions
  • Rename/Modify step definitions
  • Edit rich-text help for each step definition

When the user writes the test scenarios within the Gherkin editor, all suggestions are then based on the Step Definitions stored in this centralized catalog.

tree input 1  

Probably one of the best interests is the Rename/Modify, as it will propagate the changes in all the tests that already include this step definition.

Chasing duplicates and similar step definitions is the trickiest task with Gherkin.

This feature greatly facilitates this.


The Gherkin Editor in XStudio
To be efficient, a Gherkin editor must be much more than a simple text editor. It must have access to the Step Definition catalog and store the Gherkin syntax as a structure of Keywords and Step Definition references.

Storing only text is leading to creating a not maintainable system.

Let's see what we provide in our editor:

Syntax highlighting
Of course, a critical requirement for a Gherkin editor is syntax highlighting. This allows the user to be immediately notified in case of a typo in one of the keywords (Scenario, Given, When, Then, And, But etc.) or Step Definitions.

Of course, the Gherkin editor in XStudio supports this and we can customize the colors.

tree input 1  

Auto-formatting
Gherkin is relying a lot on indentation to make the features and scenario nice to read.
A single right-click on Format Document will do that job right for you.

tree input 1       tree input 1  

Auto-completion/Suggestions
Auto-completion/Suggestions is the most fundamental feature any Gherkin Editor should have.
When you start typing after a keyword, only valid Step Definitions (coming from the Step Definition catalog) are suggested.
This prevents from having typo (then error at run time) as Step Definition must be provided using a valid name.

But our editor does not just provide suggestion based on previous scenarios you already defined. Once you pick a suggestion, internally, it will not just include the step definition in the gherkin as plain-text but rather include a reference to the step definition (only stored in the XStudio Step Definition catalog).

Hence, if the step definition that we have in our catalog is renamed/modified, then the new version will be visible in ALL THE TESTS that are already using this step definition!

tree input 1  

Variable refactoring/renaming
The editor also allows you to change the value of a variable everywhere it appears in a scenario in one shot.

tree input 1  

Support of parameterization

A/B/C
The Step Definitions stored in the XStudio Step Definition catalog can use the A/B/C syntax to indicate a placeholder that can take N possible values.

Black/Blue/Green/Red

When you are in the Gherkin editor and the systems provides you a suggestion of that form, you can directly choose which value you want to use in a drop-down menu.

This is again a nice-way to prevent from typos.

tree input 1  

<variable>/Combinations
If you are using Scenario Outline, you will want to store Step Definitions containing several variables using a dedicated syntax.

<sentence> and <weight>

In this example, sentence and weigth are 2 custom variables that you'll need to valorize in a dedicated table/section.

When you are in the Gherkin editor, you will have the possibility to provide a table of values describing a list of combinations containing the value for each of the variables.

tree input 1  

{string}/{integer}
If you have stored a Step Definition with such a syntax

{string} or {integer}

Then, when you are in the Gherkin editor and the system provides you a suggestion of that form, you can directly edit the value you want to use in the scenario you're writing as a replacement of the ? character. What you provide must match the type of the placeholder.

tree input 1  

That's it. Simple. Quick. Efficient.


...and as always, all those wonderful features work on ANY browser
firefox   chrome   edge   ie   safari  

and on ANY device
pc mac tablet smartphone

ROADMAP

XStudio 8 beta version is almost done and should be ready begining of July.

Please check our roadmap for more details.

EVENTS

The JFTL 2022 Conference (Journée Française des Tests Logiciels) is now over and it was a great edition!

Eric Gavaldo (our CEO) had the opportunity to intervene as a speaker along with Mounir Tlili for the presentation "Retours d’expérience Docaposte: vers une plateforme mutualisée de gestion de référentiel de tests".

Feedbacks were pretty good and Eric wants to thank all people who were there for their numerous and interesting questions at the end of the talk.

Thanks to all the people who came to see us on our stand!

Gavaldo Consulting / XQual

436 Chemin des Tourres

06330 Roquefort-les-pins

Contact us