I want to use my Hexawise output as input to a Gherkin feature. Has any had any experience doing this either automatically or manually?

  • 1
  • Question
  • Updated 3 years ago
  • Answered
Photo of Eugene Goldfarb

Eugene Goldfarb

  • 2 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 1
Photo of Sean Johnson

Sean Johnson, CTO

  • 270 Posts
  • 26 Reply Likes
Hi Eugene,

We've certainly done it internally at Hexawise. We tend to use Gherkin data tables populated with Hexawise generated test data.

Also particularly handy are scenario outlines:

https://github.com/cucumber/cucumber/...

Let me know how you get along with it Eugene. We're quite interested in evolving the Hexawise tool in this direction so would love to know what works well for you and where you struggle with this.

Cheers,
Sean
Photo of Eugene Goldfarb

Eugene Goldfarb

  • 2 Posts
  • 0 Reply Likes
Hi Sean,
Do you have tip to output the Hexawise combinations in to datatable delimited by pipes so I can imput it directly into my Gherkin test?
| FIRSTNAME | LASTNAME | LOB |
| Adriano | Brancheri |LB2 |
| Robert | Ironsides |LB4 |
| Jane |Doe |LB1 |
Photo of Sean Johnson

Sean Johnson, CTO

  • 270 Posts
  • 26 Reply Likes
Eugene,

We use Hexawise's CSV export which then gives you a CSV file of just the test data.

It's then a "1 liner" in the scripting language of your choice to turn the CSV data into pipe data.

Here's the Ruby we use:



#!/usr/bin/env ruby

require 'csv'

tests = CSV.read("combinations.csv")
table = []
tests.each do |test|
table << "| " + test[1..-1].join(" | ") + " |\n"
end
IO.write("gherkin.txt", table.join())


The only mildly tricky part of that code is the [1..-1] on the test array. This just drops out the first element in each test, which in the CSV is the test number which isn't interesting in a gherkin table.

That script turns:


"Test Number","A","B","C"
1,"A2","B2","C1"
2,"A1","B1","C2"
3,"A2","B1","C3"
4,"A3","B3","C1"
5,"A3","B2","C2"
6,"A2","B3","C2"
7,"A3","B2","C3"
8,"A3","B3","C3"
9,"A1","B1","C3"
10,"A3","B1","C3"


into:


| A | B | C |
| A2 | B2 | C1 |
| A1 | B1 | C2 |
| A2 | B1 | C3 |
| A3 | B3 | C1 |
| A3 | B2 | C2 |
| A2 | B3 | C2 |
| A3 | B2 | C3 |
| A3 | B3 | C3 |
| A1 | B1 | C3 |
| A3 | B1 | C3 |


Cheers,
Sean
Photo of Justin Hunter, Hexawise Founder

Justin Hunter, Hexawise Founder, Founder and CEO

  • 246 Posts
  • 15 Reply Likes
John has recently created a blog post that describes how to use Hexawise with Gherkin (Given / When / Then) formats:

https://www.hexawise.com/posts/using-hexawise-to-export-values-for-gherkin-given-when-then