Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Any Gherkin / Cucumber support?


#1

I guess there are several people out there, that use the Gherkin language to define their test cases. (https://github.com/cucumber/cucumber/wiki)

My combination of Gherkin and TestRail looks like this (I use seperated steps without expected results):

Title = Scenario: Register
Step 1 = Given I am on the page "example.de/register"
Step 2 = When I fill out the register form:
| forename | Peter |
| surname | Hackt |
| email | peter.hackt@example.de |
| password | peterhackt123 |
Step 3 = And I save
Step 4 = Then the page reloads
Step 5 = And I see the message “You have registered successfully”

For better manual test execution I would like to have syntax highlighting and formatting for the “tables” in pipes like in an editor.
Here is an example how it could look by opening the details page of a test case:

Title = [color=blue]Scenario:[/color] Register
Step 1 = [color=green]Given[/color] I am on the page [color=orange]example.de/register[/color]
Step 2 = [color=green]When[/color] I fill out the register form:
| forename | Peter |
| surname | Hackt |
| email | peter.hackt@example.de |
| password | peterhackt123 |
Step 3 = [color=green]And[/color] I save
Step 4 = [color=green]Then[/color] the page reloads
Step 5 = [color=green]And[/color] I see the message [color=orange]“You have registered successfully”[/color]

Could we get something like this in a future update, or did someone already wrote a script for something like this?


#2

Hello Daniel,

Thanks for your posting. We will make sure to look into this and this looks really useful, thanks for the suggestion. I’m not sure if we have customers already using this approach but I agree that syntax highlighting or other means of giving the text a bit more structure would be great to have. I’ve added this to our feature request list for now and please let me know in case you have any further questions or feedback.

Regards,
Tobias


#3

Hi Tobias,

thank you for the quick reply.
I tried to do it by myself with an UI Script to append a with css classes for the words that I need to highlight.
If I append the to a word in the steps (Given / When etc.), the
and

tags disappear that TestRail sets automatically, resulting in worse formatting.

Here is a jsfiddle example http://jsfiddle.net/PELkt/


#4

Hello Daniel,

Thanks for the update. Could you post a full example with the UI script or an example of the text before/after the modification?

Regards,
Tobias


#5

Create a UI script that will replace your textareas on the case edit page with ace editor, it has built in support for highlighting Gherkin files. You can also export your step definitions as a javascript array and inject that into ace editor so you will get autocomplete for all your step definitions.

Ace editor: http://ace.c9.io

Once you have all your Gherkins defined as cases you can build a tool to download those using the API and build your own .feature files from them, and you are ready to go. In your test runner you can implement a hook to report back each test result to TestRail automatically after each scenario is run.

You can also create a second UI script that converts your Gherkin | tables | to

on the test case view page.

#6

I created a little gem that enables easy integration of Cucumber and Testrail.

Currently it’s private, I’m asking the organisation if it’s OK to push it out to GitHub and RubyGems.

This is what it does;-

  1. You can load testsuites with testcases from your feature files
  2. You can update testcases from your feature files
  3. You can run your feature files and have the results uploaded into testruns for the testsuites.

We use it heavily, even just to populate testsuites with testcases without running the actual tests. We have nightly Jenkins jobs that run our Cucumber feature files, which load the results into Testrail, and then Testrail emails the reports to people who need to know.

The gem currently works with Cucumber < 2.0, I’m spending this morning updating it to work with Cucumber >=2.0

It works via the Testrail REST api. Which is simple once you’ve played with it for a few hours.


Has anyone worked with Cucumber/Gherkin within Testrail?
#7

I already coded all that features in our Java Testenvironment.
What I really need is better visualization of Cucumber / Gherkin within Testrail itselfe.


#8

Mb it will help someone https://rubygems.org/gems/test_rail_integration using for Ruby+Cucumber+CI+TestRail by @tags - cases ID in TestRail, cucumber 1.3.9.
If you have any questions or improvements don’t hesitate to contact me.


Configuring Test Cases to create BDD
#9

Thanks for sharing this, Kirikami, this looks great!

Regards,
Tobias