Discussion:
[Cucumber] In Feature file ,how to read input from external source ( csv file) instead of "Example section
(too old to reply)
Somesh Rathi
2016-04-20 04:51:51 UTC
Permalink
Raw Message
Hi All,

I have feature file Scenario like below. Here instead of specifying the input into the "Examples" section , i want to read from external CSV file.

My step file ( where i write step definition ) is in java language.

I googled a lot before posting into this forum, but i couldnt find any solution for java on how to read input from CSV file into feature file. I found some solution for ruby.

But we are not using ruby language to write step defintion.





Scenario Outline: Testing to verify service returns till date response when passing all the mandatory parameters

When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code


Examples:
|CIF|BU|
| 12345|58|

| 98765|59|



I could write the new step , for e.g. Read data from <File> , corresponding step defintion (java file) - read the values from CSV and assign to variables like CIF , BU.


However problem is i wanted to run the same scenario for different data set ( for e.g. for second record in table), value of variables like BU , CIF should change.




my CSV file is like data.csv


CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thomas Sundberg
2016-04-20 07:09:40 UTC
Permalink
Raw Message
Hi!
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the
input into the "Examples" section , i want to read from external CSV file.
I would not choose to try to import data from a CSV file into Gherkin.
If I had to read data from the CSV file, I would do it using a helper
method I implemented in Java and use it from my step definition. Or
any supporting code the steps are using.

This said, it is unclear to me why you would use Cucumber and Gherkin
if you hide important information in a CSV file. I would probably have
the other approach and use a data table in Gherkin if I have many
examples I need to run through.

Think about the benefit Gherkin brings and why you want to use
something else. You may end up with the conclusion that you don't need
Gherkin or that you are using Gherkin incorrect. Cucumber and Gherkin
are opinionated tools, they don't support you in some cases. Maybe
this is one of them.

HTH
Thomas
Post by Somesh Rathi
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any
solution for java on how to read input from CSV file into feature file. I
found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response when
passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> , corresponding
step defintion (java file) - read the values from CSV and assign to
variables like CIF , BU.
However problem is i wanted to run the same scenario for different data set
( for e.g. for second record in table), value of variables like BU , CIF
should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg

Better software through faster feedback

Join me for a Selenium kickstart in Timisoara, Romania in April.
http://mozaicworks.com/public-trainings-and-workshops/selenium-webdriver-test-automation-for-web-applications/

Interested in a BDD Kickstart in Stockholm?
https://cucumber.io/events/bdd-kickstart-stockholm-16
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Somesh Rathi
2016-04-20 08:21:15 UTC
Permalink
Raw Message
Thanks a lot Thomas for reply.

Yes i can read the data from the external csv file using java helper and
assign to variables in step defintion class (which is another java file).

But the problem is i wanted to run scenario for every record in file. For
each CIF/BU combination , i wanted to invoke backend service ,get the data
and verify the data.

My challenge is - how to run the scenario ( which contain multiple steps)
multiple times , if i dont provide the data tables (Examples section.)

Intention behind externalizing the data into the CSV file , instead of
Example section is :- Business Analyst/Product owner can provide/update
only the CSV file and they dont need to touch the Feature file.

Thanks
Somesh
+6590830291
Post by Thomas Sundberg
Hi!
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the
input into the "Examples" section , i want to read from external CSV
file.
I would not choose to try to import data from a CSV file into Gherkin.
If I had to read data from the CSV file, I would do it using a helper
method I implemented in Java and use it from my step definition. Or
any supporting code the steps are using.
This said, it is unclear to me why you would use Cucumber and Gherkin
if you hide important information in a CSV file. I would probably have
the other approach and use a data table in Gherkin if I have many
examples I need to run through.
Think about the benefit Gherkin brings and why you want to use
something else. You may end up with the conclusion that you don't need
Gherkin or that you are using Gherkin incorrect. Cucumber and Gherkin
are opinionated tools, they don't support you in some cases. Maybe
this is one of them.
HTH
Thomas
Post by Somesh Rathi
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any
solution for java on how to read input from CSV file into feature file.
I
Post by Somesh Rathi
found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response
when
Post by Somesh Rathi
passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> ,
corresponding
Post by Somesh Rathi
step defintion (java file) - read the values from CSV and assign to
variables like CIF , BU.
However problem is i wanted to run the same scenario for different data
set
Post by Somesh Rathi
( for e.g. for second record in table), value of variables like BU , CIF
should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google
Groups
Post by Somesh Rathi
"Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Somesh Rathi
For more options, visit https://groups.google.com/d/optout.
--
Thomas Sundberg
M. Sc. in Computer Science
Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Better software through faster feedback
Join me for a Selenium kickstart in Timisoara, Romania in April.
http://mozaicworks.com/public-trainings-and-workshops/selenium-webdriver-test-automation-for-web-applications/
Interested in a BDD Kickstart in Stockholm?
https://cucumber.io/events/bdd-kickstart-stockholm-16
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrew Premdas
2016-04-20 16:23:28 UTC
Permalink
Raw Message
Somesh,

You don't need cucumber to do this. Cucumber is all about using natural
language (words) to describe things and then using those descriptions to
drive development. In your case the output from running your scenarios and
the scenarios themselves have almost no meaning, they are just data.
Instead of using cucumber, just use a unit test to do what you want.
Because such tools are all implemented in a programming language its easy
to do csv imports to drive tests. And you can easily collect results and
output them however you want.

Generally any time you want to do something exhaustive and repetitive with
cucumber i.e. do something for many combinations of something (in your case
CIF/BU pairs) you are misusing the tool and just making things harder than
they need to be.

All best

Andrew
Post by Somesh Rathi
Thanks a lot Thomas for reply.
Yes i can read the data from the external csv file using java helper and
assign to variables in step defintion class (which is another java file).
But the problem is i wanted to run scenario for every record in file. For
each CIF/BU combination , i wanted to invoke backend service ,get the data
and verify the data.
My challenge is - how to run the scenario ( which contain multiple steps)
multiple times , if i dont provide the data tables (Examples section.)
Intention behind externalizing the data into the CSV file , instead of
Example section is :- Business Analyst/Product owner can provide/update
only the CSV file and they dont need to touch the Feature file.
Thanks
Somesh
+6590830291
Post by Thomas Sundberg
Hi!
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the
input into the "Examples" section , i want to read from external CSV
file.
I would not choose to try to import data from a CSV file into Gherkin.
If I had to read data from the CSV file, I would do it using a helper
method I implemented in Java and use it from my step definition. Or
any supporting code the steps are using.
This said, it is unclear to me why you would use Cucumber and Gherkin
if you hide important information in a CSV file. I would probably have
the other approach and use a data table in Gherkin if I have many
examples I need to run through.
Think about the benefit Gherkin brings and why you want to use
something else. You may end up with the conclusion that you don't need
Gherkin or that you are using Gherkin incorrect. Cucumber and Gherkin
are opinionated tools, they don't support you in some cases. Maybe
this is one of them.
HTH
Thomas
Post by Somesh Rathi
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any
solution for java on how to read input from CSV file into feature file.
I
Post by Somesh Rathi
found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response
when
Post by Somesh Rathi
passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> ,
corresponding
Post by Somesh Rathi
step defintion (java file) - read the values from CSV and assign to
variables like CIF , BU.
However problem is i wanted to run the same scenario for different data
set
Post by Somesh Rathi
( for e.g. for second record in table), value of variables like BU ,
CIF
Post by Somesh Rathi
should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google
Groups
Post by Somesh Rathi
"Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Somesh Rathi
For more options, visit https://groups.google.com/d/optout.
--
Thomas Sundberg
M. Sc. in Computer Science
Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Better software through faster feedback
Join me for a Selenium kickstart in Timisoara, Romania in April.
http://mozaicworks.com/public-trainings-and-workshops/selenium-webdriver-test-automation-for-web-applications/
Interested in a BDD Kickstart in Stockholm?
https://cucumber.io/events/bdd-kickstart-stockholm-16
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
------------------------
Andrew Premdas
blog.andrew.premdas.org
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yaroslav Yasynskyy
2016-10-18 22:38:14 UTC
Permalink
Raw Message
Hi Somesh,

Did you solve this?

I have the same challenge and was not able to find the solution yet.

Thanks,
Yaroslav
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the input into the "Examples" section , i want to read from external CSV file.
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any solution for java on how to read input from CSV file into feature file. I found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response when passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> , corresponding step defintion (java file) - read the values from CSV and assign to variables like CIF , BU.
However problem is i wanted to run the same scenario for different data set ( for e.g. for second record in table), value of variables like BU , CIF should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thomas Sundberg
2016-10-19 06:24:22 UTC
Permalink
Raw Message
On 19 October 2016 at 00:38, Yaroslav Yasynskyy
Post by Yaroslav Yasynskyy
Hi Somesh,
Did you solve this?
This problem is solved. You don't that.

Read the responses in this thread carefully. If you still have
questions, please ask them.

A short answer is, however, don't hide the information needed when you
want to drive your application. All relevant information should be
found in the feature file. Hiding important things in other files will
make your life unnecessary complicated.

If you need to read input from Excel, do it in the step definition
where you need the data. Or use other tooling if it is testing, and
only testing, you have a need for.

HTH
Thomas
Post by Yaroslav Yasynskyy
I have the same challenge and was not able to find the solution yet.
Thanks,
Yaroslav
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the
input into the "Examples" section , i want to read from external CSV file.
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any
solution for java on how to read input from CSV file into feature file. I
found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response
when passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> ,
corresponding step defintion (java file) - read the values from CSV and
assign to variables like CIF , BU.
However problem is i wanted to run the same scenario for different data
set ( for e.g. for second record in table), value of variables like BU , CIF
should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://www.thinkcode.se/blog
Twitter: @thomassundberg

Better software through faster feedback
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
shailendra singh
2017-03-15 06:17:17 UTC
Permalink
Raw Message
I had similar issue , let see what issue I tried to solve:



I have a 100+ feature file, and each feature file have scenario outlines ex.



Below is one feature file



Scenario outline: As a user I should be able to create a new client

Given I am app home page

Then I input <fname> in first name

And I input <lname> in last name

And I selected city as <city name>

And I enter biuilding <bld name>

And I enter taf type as <taf>

Example:

|fname|lname|city_name|bld_name|taf|



Now the challenge is application shows different set of values for 'city',
'bld' and 'taf' which depends on which type of customer loggedin. And we
had 6type of customer. And at a time I need to check of one customer type.
So to test all 6 customers types I have below option:



1. Create 1 feature file for each 6 type of customers (so total 6
feature file) : So problem is maintenance and update feature file.
2. second is if there is any way to pass CSV file in example section ,
so that at run time I can change csv file according to login customer.



So I tried in 2nd way , there is no straight forward way but I did a work
around here.



1. Create feature file as template and put in template folder.

Scenario outline: As a user I should be able to create a new client

Given I am app home page

Then I input <fname> in first name

And I input <lname> in last name

And I selected city as <city name>

And I enter biuilding <bld name>

And I enter taf type as <taf>

Example:



Note: No data in Example:

1. I have written a utility which copy the feature file from template
put it in features folder and rename it to .feature
2. Then that utility read configured customer data CSV file and write in
Example: section a newly created feature file.
3. And at run time we run feature file created from template.



Note: It's just a work around to solve different set of data problem. Hope
it may help some one



Let me know if need any help.
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the input into the "Examples" section , i want to read from external CSV file.
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any solution for java on how to read input from CSV file into feature file. I found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response when passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> , corresponding step defintion (java file) - read the values from CSV and assign to variables like CIF , BU.
However problem is i wanted to run the same scenario for different data set ( for e.g. for second record in table), value of variables like BU , CIF should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrew Premdas
2017-03-15 07:54:34 UTC
Permalink
Raw Message
This is a really good example of how to work with Cucumber to do something
that Cucumber doesn't (and hopefully never will) support. By scripting at a
higher level and using a script to drive Cucumber Shallendra has created a
workable solution for doing data driven features.

Now personally I think data driven features are a really bad idea so please
don't take this as a recommendation for working in this way. But if you do
decide that you have to have data driven features you would do well to
follow this example.

All best

Andrew

On 15 March 2017 at 06:17, shailendra singh <
Post by shailendra singh
I have a 100+ feature file, and each feature file have scenario outlines ex.
Below is one feature file
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
|fname|lname|city_name|bld_name|taf|
Now the challenge is application shows different set of values for
'city', 'bld' and 'taf' which depends on which type of customer loggedin.
And we had 6type of customer. And at a time I need to check of one customer
1. Create 1 feature file for each 6 type of customers (so total 6
feature file) : So problem is maintenance and update feature file.
2. second is if there is any way to pass CSV file in example section
, so that at run time I can change csv file according to login customer.
So I tried in 2nd way , there is no straight forward way but I did a work
around here.
1. Create feature file as template and put in template folder.
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
1. I have written a utility which copy the feature file from template
put it in features folder and rename it to .feature
2. Then that utility read configured customer data CSV file and write
in Example: section a newly created feature file.
3. And at run time we run feature file created from template.
Note: It's just a work around to solve different set of data problem. Hope
it may help some one
Let me know if need any help.
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the input into the "Examples" section , i want to read from external CSV file.
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any solution for java on how to read input from CSV file into feature file. I found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response when passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> , corresponding step defintion (java file) - read the values from CSV and assign to variables like CIF , BU.
However problem is i wanted to run the same scenario for different data set ( for e.g. for second record in table), value of variables like BU , CIF should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
------------------------
Andrew Premdas
blog.andrew.premdas.org
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Pankaj Tiwari
2017-03-15 10:28:06 UTC
Permalink
Raw Message
Hi Shailendra,

If Possible,can you please provide me that utility ?

-Thanks
Pankaj
Post by shailendra singh
I have a 100+ feature file, and each feature file have scenario outlines ex.
Below is one feature file
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
|fname|lname|city_name|bld_name|taf|
Now the challenge is application shows different set of values for
'city', 'bld' and 'taf' which depends on which type of customer loggedin.
And we had 6type of customer. And at a time I need to check of one customer
1. Create 1 feature file for each 6 type of customers (so total 6
feature file) : So problem is maintenance and update feature file.
2. second is if there is any way to pass CSV file in example section
, so that at run time I can change csv file according to login customer.
So I tried in 2nd way , there is no straight forward way but I did a work
around here.
1. Create feature file as template and put in template folder.
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
1. I have written a utility which copy the feature file from template
put it in features folder and rename it to .feature
2. Then that utility read configured customer data CSV file and write
in Example: section a newly created feature file.
3. And at run time we run feature file created from template.
Note: It's just a work around to solve different set of data problem. Hope
it may help some one
Let me know if need any help.
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the input into the "Examples" section , i want to read from external CSV file.
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any solution for java on how to read input from CSV file into feature file. I found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response when passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> , corresponding step defintion (java file) - read the values from CSV and assign to variables like CIF , BU.
However problem is i wanted to run the same scenario for different data set ( for e.g. for second record in table), value of variables like BU , CIF should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
shailendra singh
2017-03-15 11:34:50 UTC
Permalink
Raw Message
Sure Pankaj, it is small code written in ruby. tell me your mail id , i
will send it to you.
Post by Pankaj Tiwari
Hi Shailendra,
If Possible,can you please provide me that utility ?
-Thanks
Pankaj
Post by shailendra singh
I have a 100+ feature file, and each feature file have scenario outlines ex.
Below is one feature file
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
|fname|lname|city_name|bld_name|taf|
Now the challenge is application shows different set of values for
'city', 'bld' and 'taf' which depends on which type of customer loggedin.
And we had 6type of customer. And at a time I need to check of one customer
1. Create 1 feature file for each 6 type of customers (so total 6
feature file) : So problem is maintenance and update feature file.
2. second is if there is any way to pass CSV file in example section
, so that at run time I can change csv file according to login customer.
So I tried in 2nd way , there is no straight forward way but I did a work
around here.
1. Create feature file as template and put in template folder.
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
1. I have written a utility which copy the feature file from template
put it in features folder and rename it to .feature
2. Then that utility read configured customer data CSV file and write
in Example: section a newly created feature file.
3. And at run time we run feature file created from template.
Note: It's just a work around to solve different set of data problem.
Hope it may help some one
Let me know if need any help.
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the input into the "Examples" section , i want to read from external CSV file.
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any solution for java on how to read input from CSV file into feature file. I found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response when passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> , corresponding step defintion (java file) - read the values from CSV and assign to variables like CIF , BU.
However problem is i wanted to run the same scenario for different data set ( for e.g. for second record in table), value of variables like BU , CIF should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sharan Kumar
2017-06-09 15:59:48 UTC
Permalink
Raw Message
Hi shailendra ,

I have been looking for a solution to this problem
.Could you please send your utility class to this email id -
***@gmail.com

Thanks in Advance

Regards
Sharan
Post by shailendra singh
I have a 100+ feature file, and each feature file have scenario outlines ex.
Below is one feature file
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
|fname|lname|city_name|bld_name|taf|
Now the challenge is application shows different set of values for
'city', 'bld' and 'taf' which depends on which type of customer loggedin.
And we had 6type of customer. And at a time I need to check of one customer
1. Create 1 feature file for each 6 type of customers (so total 6
feature file) : So problem is maintenance and update feature file.
2. second is if there is any way to pass CSV file in example section
, so that at run time I can change csv file according to login customer.
So I tried in 2nd way , there is no straight forward way but I did a work
around here.
1. Create feature file as template and put in template folder.
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
1. I have written a utility which copy the feature file from template
put it in features folder and rename it to .feature
2. Then that utility read configured customer data CSV file and write
in Example: section a newly created feature file.
3. And at run time we run feature file created from template.
Note: It's just a work around to solve different set of data problem. Hope
it may help some one
Let me know if need any help.
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the input into the "Examples" section , i want to read from external CSV file.
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any solution for java on how to read input from CSV file into feature file. I found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response when passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> , corresponding step defintion (java file) - read the values from CSV and assign to variables like CIF , BU.
However problem is i wanted to run the same scenario for different data set ( for e.g. for second record in table), value of variables like BU , CIF should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Roberto Lo Giacco
2017-06-13 20:03:58 UTC
Permalink
Raw Message
Post by Sharan Kumar
Hi shailendra ,
I have been looking for a solution to this problem
.Could you please send your utility class to this email id -
To me this is unbelievable: you are asking for advice on a forum where
people expert of the tool are saying what you are doing is WRONG and you
keep going?!?

The whole idea of using Cucumber in this context is simply WRONG. People
with years of experience with the tool which have also published articles
and given courses on the topic keeps repeating this is WRONG...

You have been given reasons and alternatives and you keep going down your
route nonetheless? And you also keep reviving this thread?

Let me state it once again:

'|| ||` '||'''|, .|''''|, '||\ ||` .|'''''| ||
|| || || || || || ||\\ || || . ||
|| /\ || ||...|' || || || \\ || || |''|| ||
\\//\\// || \\ || || || \\|| || ||
\/ \/ .|| \\. `|....|' .|| \||. `|....|' ||


So, at least, please stop reviving this thread which spreads a bad usage
habit.

Thanks
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sanjay Shukla
2017-10-04 20:34:43 UTC
Permalink
Raw Message
Hi Shailendra,

*Could you please share the same utility with me.*

*to archive the same way -*

*1. created feature file*
*2. then running the script *
*3. copy the feature file with different name*
*4. replacing or writing the data from excel to feature file*
*5. then deleting the old feature file*

*but some how its not working correctly.*
Post by shailendra singh
I have a 100+ feature file, and each feature file have scenario outlines ex.
Below is one feature file
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
|fname|lname|city_name|bld_name|taf|
Now the challenge is application shows different set of values for
'city', 'bld' and 'taf' which depends on which type of customer loggedin.
And we had 6type of customer. And at a time I need to check of one customer
1. Create 1 feature file for each 6 type of customers (so total 6
feature file) : So problem is maintenance and update feature file.
2. second is if there is any way to pass CSV file in example section
, so that at run time I can change csv file according to login customer.
So I tried in 2nd way , there is no straight forward way but I did a work
around here.
1. Create feature file as template and put in template folder.
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
1. I have written a utility which copy the feature file from template
put it in features folder and rename it to .feature
2. Then that utility read configured customer data CSV file and write
in Example: section a newly created feature file.
3. And at run time we run feature file created from template.
Note: It's just a work around to solve different set of data problem. Hope
it may help some one
Let me know if need any help.
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the input into the "Examples" section , i want to read from external CSV file.
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any solution for java on how to read input from CSV file into feature file. I found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response when passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> , corresponding step defintion (java file) - read the values from CSV and assign to variables like CIF , BU.
However problem is i wanted to run the same scenario for different data set ( for e.g. for second record in table), value of variables like BU , CIF should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Roberto Lo Giacco
2017-10-05 08:57:01 UTC
Permalink
Raw Message
Post by Pankaj Tiwari
Hi Shailendra,
*Could you please share the same utility with me.*
*to archive the same way -*
*1. created feature file*
*2. then running the script *
*3. copy the feature file with different name*
*4. replacing or writing the data from excel to feature file*
*5. then deleting the old feature file*
*but some how its not working correctly.*
​And my wish is that it will never work​, EVER.

Don't you understand this is useless and you could achieve the exact same
result with a very simple unit or integration test? Why are willing to
spend so much time in creating those feature files which will then drive
the same piece of code voer and over and none wille ver read? Even you, the
creator of such feature files will not read them: you are creating a tool
to generate them!
Is it that difficult to understand a feature which is not shared with
anyone and discussed, which doesn't start a conversation... is useless?

Take it this way: your tests, which will cover 100% of your scenarios, if
generated like you do will:

- take A LOT more time to execute than having the same test, written
without Cucumber
- be unmaintainable, as most of the changes which might occur in the
future will require to re-generate the features
- be more difficult to trace down, as you will be reported an error
within a step definition using parameter XYZ, but you'll have to track down
that parameter in your generated feature files, if the issue is a bad
parameter
- be tougher to understand and debug


Why are you doing so? For which benefit?

Do you really heate yourself and your colleagues so much?

Roberto
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raghav Joshi
2017-10-10 14:37:12 UTC
Permalink
Raw Message
Hello Shailendra,

Could you please send me the utility which u have written for template
and run time feature file creation. Also will it support for java
framework.
Post by shailendra singh
I have a 100+ feature file, and each feature file have scenario outlines ex.
Below is one feature file
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
|fname|lname|city_name|bld_name|taf|
Now the challenge is application shows different set of values for
'city', 'bld' and 'taf' which depends on which type of customer loggedin.
And we had 6type of customer. And at a time I need to check of one customer
1. Create 1 feature file for each 6 type of customers (so total 6
feature file) : So problem is maintenance and update feature file.
2. second is if there is any way to pass CSV file in example section
, so that at run time I can change csv file according to login customer.
So I tried in 2nd way , there is no straight forward way but I did a work
around here.
1. Create feature file as template and put in template folder.
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
1. I have written a utility which copy the feature file from template
put it in features folder and rename it to .feature
2. Then that utility read configured customer data CSV file and write
in Example: section a newly created feature file.
3. And at run time we run feature file created from template.
Note: It's just a work around to solve different set of data problem. Hope
it may help some one
Let me know if need any help.
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the input into the "Examples" section , i want to read from external CSV file.
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any solution for java on how to read input from CSV file into feature file. I found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response when passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> , corresponding step defintion (java file) - read the values from CSV and assign to variables like CIF , BU.
However problem is i wanted to run the same scenario for different data set ( for e.g. for second record in table), value of variables like BU , CIF should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Chuck van der Linden
2017-10-13 16:04:50 UTC
Permalink
Raw Message
Did you even read the thread? DON'T DO THIS..

If you need to be reading in test data or terms from a file instead of
using example tables then CUCUMBER IS NOT THE RIGHT TOOL FOR WHAT YOU ARE
DOING. Put down the socket wrench you are trying to use to pound on the
nail and go find a freaking hammer.

Gods I would give up a body part for google to make it possible for us to
block further replies to a thread.
Post by Raghav Joshi
Hello Shailendra,
Could you please send me the utility which u have written for
template and run time feature file creation. Also will it support for java
framework.
Post by shailendra singh
I have a 100+ feature file, and each feature file have scenario outlines ex.
Below is one feature file
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
|fname|lname|city_name|bld_name|taf|
Now the challenge is application shows different set of values for
'city', 'bld' and 'taf' which depends on which type of customer loggedin.
And we had 6type of customer. And at a time I need to check of one customer
1. Create 1 feature file for each 6 type of customers (so total 6
feature file) : So problem is maintenance and update feature file.
2. second is if there is any way to pass CSV file in example section
, so that at run time I can change csv file according to login customer.
So I tried in 2nd way , there is no straight forward way but I did a work
around here.
1. Create feature file as template and put in template folder.
Scenario outline: As a user I should be able to create a new client
Given I am app home page
Then I input <fname> in first name
And I input <lname> in last name
And I selected city as <city name>
And I enter biuilding <bld name>
And I enter taf type as <taf>
1. I have written a utility which copy the feature file from template
put it in features folder and rename it to .feature
2. Then that utility read configured customer data CSV file and write
in Example: section a newly created feature file.
3. And at run time we run feature file created from template.
Note: It's just a work around to solve different set of data problem.
Hope it may help some one
Let me know if need any help.
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the input into the "Examples" section , i want to read from external CSV file.
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any solution for java on how to read input from CSV file into feature file. I found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response when passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> , corresponding step defintion (java file) - read the values from CSV and assign to variables like CIF , BU.
However problem is i wanted to run the same scenario for different data set ( for e.g. for second record in table), value of variables like BU , CIF should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Matt Wynne
2017-10-13 19:17:31 UTC
Permalink
Raw Message
Some of these comments are getting a bit too personal for my liking. Let's please keep it respectful, however daft we think other people's ideas might be 😀

❀ https://github.com/cucumber/cucumber/blob/master/CODE_OF_CONDUCT.md ❀
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Roberto Lo Giacco
2017-10-13 22:10:36 UTC
Permalink
Raw Message
Post by Matt Wynne
Some of these comments are getting a bit too personal for my liking. Let's
please keep it respectful, however daft we think other people's ideas might
be 😀
❀ https://github.com/cucumber/cucumber/blob/master/CODE_OF_CONDUCT.md ❀
Sorry Matt,

Please accept my apologies if you believe I've once again crossed the
boundary, but I believe respect should be reciprocal and I totally
agree with Chuck and his disappointment.

Ignoring our warnings and keep reviving an old thread is not a good sign of
respect... I personally feel my effort to help them understand this is a
bad use of Cucumber is wasted and I was tempted to unsubscribe when I saw
the n-th message on this topic.

The fact no message did ask "why do you think is that wrong" or "could you
explain what do you mean" is another demonstration my previous attempts are
just simply ignored...

Now, I know I can't say what is wrong and what is right, but as I've used
Cucumber for more than 6 years now and I believe I've got enough ground to
say "guys, what you are trying to do is a bad use of the tool".
I'm trying to protect Cucumber from misuse, which has caused, in my
personal experience, the biggest difficulties in its adoption.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Chuck van der Linden
2017-10-16 19:23:19 UTC
Permalink
Raw Message
Post by Matt Wynne
Some of these comments are getting a bit too personal for my liking. Let's
please keep it respectful, however daft we think other people's ideas might
be 😀
❀ https://github.com/cucumber/cucumber/blob/master/CODE_OF_CONDUCT.md ❀
I Agree my response was less than fully respectful.. frustration got the
better of me, my apologies for that.

I am confused as to what part of my response you felt was 'too personal'?
Unless you felt my 'using the wrong tool' analogy was aimed at the person
not the situation?
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
srininivas sunkari
2017-04-12 03:37:18 UTC
Permalink
Raw Message
Hi Shailendra,

I also have same problem what you faced. Can you please share the utility
on below email id.

***@gmail.com

Thanks,
Srinivas Sunkari
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the input into the "Examples" section , i want to read from external CSV file.
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any solution for java on how to read input from CSV file into feature file. I found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response when passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> , corresponding step defintion (java file) - read the values from CSV and assign to variables like CIF , BU.
However problem is i wanted to run the same scenario for different data set ( for e.g. for second record in table), value of variables like BU , CIF should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
m***@gmail.com
2017-05-18 06:49:43 UTC
Permalink
Raw Message
I created a java class that imported all the datas from an excel file using
Apache poi and then I created a file in project folder structure using
".feature" extension and then invoked the feature file from steps class I
believe.
Post by Somesh Rathi
Hi All,
I have feature file Scenario like below. Here instead of specifying the input into the "Examples" section , i want to read from external CSV file.
My step file ( where i write step definition ) is in java language.
I googled a lot before posting into this forum, but i couldnt find any solution for java on how to read input from CSV file into feature file. I found some solution for ruby.
But we are not using ruby language to write step defintion.
Scenario Outline: Testing to verify service returns till date response when passing all the mandatory parameters
When I pass the CIF <CIF>,BU <BU>
And I hit the service
And I Check for the Success Status Code
|CIF|BU|
| 12345|58|
| 98765|59|
I could write the new step , for e.g. Read data from <File> , corresponding step defintion (java file) - read the values from CSV and assign to variables like CIF , BU.
However problem is i wanted to run the same scenario for different data set ( for e.g. for second record in table), value of variables like BU , CIF should change.
my CSV file is like data.csv
CIF,BU
12345,58
98765,59
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...