Discussion:
[Cucumber]
(too old to reply)
priya lakshmi
2018-05-16 10:49:54 UTC
Permalink
Hi All,

I am new to Cucumber, i am trying to understand how it does work. I am
having basic query, like i am having n number of scenarios that has login
as the prerequsite. But i cannot have all scenarios in a single feature
file.
Query1:
In such a case how can i have a step that can be shared across different
features? If it is a single feature i can use Background.
Query2:
There are n number of scenarios distributed across different features
having a common step like " launch the xxx webportal". So for this one step
definition declared can it be reused for all of the features that has the
desired step? Or it should be defined for every features.

Regards,
Priya
--
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.
Krishna Gundala
2018-05-22 09:36:11 UTC
Permalink
You can have a feature step share among different features.
Have a <common class> name depending on your framework and define common
steps in that class.
Post by priya lakshmi
Hi All,
I am new to Cucumber, i am trying to understand how it does work. I am
having basic query, like i am having n number of scenarios that has login
as the prerequsite. But i cannot have all scenarios in a single feature
file.
In such a case how can i have a step that can be shared across different
features? If it is a single feature i can use Background.
There are n number of scenarios distributed across different features
having a common step like " launch the xxx webportal". So for this one step
definition declared can it be reused for all of the features that has the
desired step? Or it should be defined for every features.
Regards,
Priya
--
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-05-22 13:26:48 UTC
Permalink
Priya,

Remember that the scenarios should be describing behavior, not just
exercising the system.
Post by priya lakshmi
Hi All,
 I am new to Cucumber, i am trying to understand how it does work. I am
having basic query, like i am having n number of scenarios that has
login as the prerequsite. But i cannot have all scenarios in a single
feature file.
In such a case how can i have a step that can be shared across different
features? If it is a single feature i can use Background.
I push such implementation details down into the step definitions (or
the code that the step definitions call), as they're implementation
details rather than an essential part of the focus of the scenario. For
example, if I say

When the library patron visits their past borrowing history

then the step makes it clear that the user is known to the system. If
that requires logging in, the step definition will log them in. The
pseudo-code might look like the following:

patron = getPatron()
login(patron)
browser = getBrowser()
browser.fetchBorrowingHistoryPage()

I would likely encapsulate web interactions into a suite of page
objects, but there are other ways to handle this, also.
Post by priya lakshmi
There are n number of scenarios distributed across different features
having a common step like " launch the xxx webportal". So for this one
step definition declared can it be reused for all of the features that
has the desired step? Or it should be defined for every features.
If "launching the webportal" means starting the server, I would likely
start that before beginning the suite of features. I would make it so
that I could execute the scenarios against any webportal that happened
to be running.

If you want to start the webportal within the test framework, you could
do so within a startup hook. Note that it's unusual that all
interactions take place on a freshly started server. You might miss some
differences that occur when the server has been running for awhile and
has served other requests.

- George

P.S. For a deeper treatment of the layering of test automation code,
I've written a book https://leanpub.com/EvolutionaryAnatomy/ with some
advice.
--
----------------------------------------------------------------------
* 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.
Loading...