Discussion:
[Cucumber] Sharing data from one step to another in cucumber
(too old to reply)
Pravesh Prajapati
2018-03-15 06:19:11 UTC
Permalink
Raw Message
Hi Team,
Did any one knows how to achieve below things in cucumber.
1.Is there is any way, that we can take data from one step and use it in
another step in cucumber scenario?
2.How can we share test context?
Please help with some reference docs.
--
Regards,
Pravesh prajapati.
Mob:-9702600170
--
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.
Koen Prins
2018-03-15 08:25:32 UTC
Permalink
Raw Message
Hi Pravesh,

Can you add a little bit of elaboration?
- What do you mean with take data from one step to another? You mean take
the output of one step and use it as input for another?
- Where would you like to share across? Across steps, across scenario's?

Based on your answer it will be far easier to give you a fitting response.

Gr,
Koen

On Thu, Mar 15, 2018 at 7:19 AM, Pravesh Prajapati <
Post by Pravesh Prajapati
Hi Team,
Did any one knows how to achieve below things in cucumber.
1.Is there is any way, that we can take data from one step and use it in
another step in cucumber scenario?
2.How can we share test context?
Please help with some reference docs.
--
Regards,
Pravesh prajapati.
Mob:-9702600170 <(970)%20260-0170>
--
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.
--
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
2018-03-15 10:28:20 UTC
Permalink
Raw Message
Post by Koen Prins
Hi Pravesh,
Can you add a little bit of elaboration?
- What do you mean with take data from one step to another? You mean take
the output of one step and use it as input for another?
- Where would you like to share across? Across steps, across scenario's?
On top of the above rightful questions it might be helpful to know which
language/framework do you use: vanilla Java, Java + Spring, Ruby,
JavaScript, etc... That might help in providing an even more precise
answer.
--
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.
Koen Prins
2018-03-15 10:59:15 UTC
Permalink
Raw Message
Ah yes, sorry, I am shortsighted in Java ;-)
Post by Roberto Lo Giacco
Post by Koen Prins
Hi Pravesh,
Can you add a little bit of elaboration?
- What do you mean with take data from one step to another? You mean take
the output of one step and use it as input for another?
- Where would you like to share across? Across steps, across scenario's?
On top of the above rightful questions it might be helpful to know which
language/framework do you use: vanilla Java, Java + Spring, Ruby,
JavaScript, etc... That might help in providing an even more precise
answer.
--
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.
--
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.
George Dinwiddie
2018-03-15 12:31:50 UTC
Permalink
Raw Message
Pravesh,
Post by Koen Prins
Post by Koen Prins
On Thu, Mar 15, 2018 at 7:19 AM, Pravesh Prajapati
Hi Team,
Did any one knows how to achieve below things in cucumber.
1.Is there is any way, that we can take data from one step and use
it in another step in cucumber scenario?
2.How can we share test context?
Please help with some reference docs. >
Hi Pravesh,
Can you add a little bit of elaboration?
- What do you mean with take data from one step to another? You mean
take the output of one step and use it as input for another?
- Where would you like to share across? Across steps, across scenario's?
On top of the above rightful questions it might be helpful to know which
language/framework do you use: vanilla Java, Java + Spring, Ruby,
JavaScript, etc... That might help in providing an even more precise
answer.
The short answer is to store that data outside of the step definition.
In ruby cucumber (I'm not sure if it's in other flavors), there is a
"world" object that's created for each scenario. This is a natural place
to share data. Sometimes the data is only meaningful within a certain
subset of step definitions. I typically keep those related step
definitions together in one class, and they can share data in a class
variable.

Does that help?

- George
--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.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.
Pravesh Prajapati
2018-03-17 09:39:44 UTC
Permalink
Raw Message
Hi Team,
Sorry for the delay reply,
Say for example.
there is 2 steps.
1. when user verify the location "abc"
2.And enter the location "abc" in search box

now you can see I am capturing text in step one and o want to use in step 2.

How to do this.

Regards,
Pravesh P.
Post by Koen Prins
Pravesh,
Post by Koen Prins
On Thu, Mar 15, 2018 at 7:19 AM, Pravesh Prajapati <
Post by Pravesh Prajapati
Hi Team,
Did any one knows how to achieve below things in cucumber.
1.Is there is any way, that we can take data from one step and use
it in another step in cucumber scenario?
2.How can we share test context?
Please help with some reference docs. >
Hi Pravesh,
Can you add a little bit of elaboration?
- What do you mean with take data from one step to another? You mean
take the output of one step and use it as input for another?
- Where would you like to share across? Across steps, across scenario's?
On top of the above rightful questions it might be helpful to know which
language/framework do you use: vanilla Java, Java + Spring, Ruby,
JavaScript, etc... That might help in providing an even more precise answer.
The short answer is to store that data outside of the step definition. In
ruby cucumber (I'm not sure if it's in other flavors), there is a "world"
object that's created for each scenario. This is a natural place to share
data. Sometimes the data is only meaningful within a certain subset of step
definitions. I typically keep those related step definitions together in
one class, and they can share data in a class variable.
Does that help?
- George
--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.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
For more options, visit https://groups.google.com/d/optout.
--
Regards,
Pravesh prajapati.
Mob:-9702600170
--
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.
Koen Prins
2018-03-17 11:36:46 UTC
Permalink
Raw Message
What language are implementating this?

Op za 17 mrt. 2018 10:39 schreef Pravesh Prajapati <
Post by Pravesh Prajapati
Hi Team,
Sorry for the delay reply,
Say for example.
there is 2 steps.
1. when user verify the location "abc"
2.And enter the location "abc" in search box
now you can see I am capturing text in step one and o want to use in step 2.
How to do this.
Regards,
Pravesh P.
On Thu, Mar 15, 2018 at 11:31 PM, George Dinwiddie <
Post by Koen Prins
Pravesh,
Post by Koen Prins
On Thu, Mar 15, 2018 at 7:19 AM, Pravesh Prajapati <
Post by Pravesh Prajapati
Hi Team,
Did any one knows how to achieve below things in cucumber.
1.Is there is any way, that we can take data from one step and use
it in another step in cucumber scenario?
2.How can we share test context?
Please help with some reference docs. >
Hi Pravesh,
Can you add a little bit of elaboration?
- What do you mean with take data from one step to another? You mean
take the output of one step and use it as input for another?
- Where would you like to share across? Across steps, across scenario's?
On top of the above rightful questions it might be helpful to know which
language/framework do you use: vanilla Java, Java + Spring, Ruby,
JavaScript, etc... That might help in providing an even more precise answer.
The short answer is to store that data outside of the step definition. In
ruby cucumber (I'm not sure if it's in other flavors), there is a "world"
object that's created for each scenario. This is a natural place to share
data. Sometimes the data is only meaningful within a certain subset of step
definitions. I typically keep those related step definitions together in
one class, and they can share data in a class variable.
Does that help?
- George
--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.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
For more options, visit https://groups.google.com/d/optout.
--
Regards,
Pravesh prajapati.
Mob:-9702600170
--
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.
--
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
2018-03-17 18:35:14 UTC
Permalink
Raw Message
Post by Koen Prins
What language are implementating this?
​Just to avoid confusion: what language are you using to implement the
stepdefs (Cucumber code)?
I believe it would also be of some importance to know if you already use a
framework like Spring to set up your tests.

Thanks,
Roberto

<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Mail
priva di virus. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
--
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.
Marit van Dijk
2018-03-28 16:07:39 UTC
Permalink
Raw Message
JavaScript also has a world object like George describes. For Java, it is
recommended to use Dependency Injection.
Post by Roberto Lo Giacco
Post by Koen Prins
What language are implementating this?
​Just to avoid confusion: what language are you using to implement the
stepdefs (Cucumber code)?
I believe it would also be of some importance to know if you already use a
framework like Spring to set up your tests.
Thanks,
Roberto
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Mail
priva di virus. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
--
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...