Discussion:
[Cucumber] [Cucumber-Java] Skip few Step execution
(too old to reply)
Samar Mukherjee
2016-02-12 11:41:40 UTC
Permalink
Raw Message
Hi,
Can any one tell me how I can skip any step execution and in report it
should come in blue as it comes for skipped steps. I was trying to send
throw new PendingException() but it is actually skipping all the steps
beyond that which means it is actually skipping the remaining part of the
scenario.

Regards,
Samar
--
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-02-12 16:27:38 UTC
Permalink
Raw Message
Thats what its supposed to do. Cucumber is not designed to allow you to
skip steps and continue, because generally scenarios don't make sense when
you skip steps.

e.g

Given I login
When I view my profile

doesn't make sense/work if you skip the login bit.
Post by Samar Mukherjee
Hi,
Can any one tell me how I can skip any step execution and in report it
should come in blue as it comes for skipped steps. I was trying to send
throw new PendingException() but it is actually skipping all the steps
beyond that which means it is actually skipping the remaining part of the
scenario.
Regards,
Samar
--
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.
Fabian T.
2017-10-05 09:16:53 UTC
Permalink
Raw Message
Doesnt it make sense, if we write one feature-file for both platforms
(Android & IOs). E.g.:

When user starts app
When user waits 5 seconds
Then activitiy "LogIn" is displayed
Then user sees element "loginButton"

The step: "Then activitiy "LogIn" is displayed " should be skipped on IOs
because there is no concept for activities like in android, so it should
not fail on IOs but simply skipped?

Regards
Fabian
Post by Andrew Premdas
Thats what its supposed to do. Cucumber is not designed to allow you to
skip steps and continue, because generally scenarios don't make sense when
you skip steps.
e.g
Given I login
When I view my profile
doesn't make sense/work if you skip the login bit.
Post by Samar Mukherjee
Hi,
Can any one tell me how I can skip any step execution and in report it
should come in blue as it comes for skipped steps. I was trying to send
throw new PendingException() but it is actually skipping all the steps
beyond that which means it is actually skipping the remaining part of the
scenario.
Regards,
Samar
--
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.
Andrew Premdas
2017-10-12 17:17:10 UTC
Permalink
Raw Message
The reason your scenario doesn't make sense is because it is all about HOW
something is done. What scenarios should be about is WHAT is being done and
WHY its important. As far as this scenario is concerned the only thing that
is important (the behaviour) is that you can login. Its completely
irrelevant to a scenario that logging in on Android is different from
logging in on IOS. When you implement your scenario you write step
definitions. Here you can deal with different implementations. So for your
scenario which should be

Scenario: User can login
Given I am a user
When I login
Then I should be logged in

You can write a crude step def like

When "I login" do
if ios?
ios_login user: @i
elsif android?
android_login: @i
end
end

If you want to improve this code organisation you can move the conditional
further down so you might end up with

When "I login" do
login user: @i
end

def login
if ios?
...


Because step definitions are code, they can call more code, and at any
point that code can decide whether we are running on Android Ios or god
forbid Windows. Code is the place to make decisions about HOW to do stuff,

Scenarios are only for describing WHAT (abstract/naming) and WHY
(justification/value).

Remember HOW has no place at all in scenarios.

HTH

Andrew
Post by Fabian T.
Doesnt it make sense, if we write one feature-file for both platforms
When user starts app
When user waits 5 seconds
Then activitiy "LogIn" is displayed
Then user sees element "loginButton"
The step: "Then activitiy "LogIn" is displayed " should be skipped on IOs
because there is no concept for activities like in android, so it should
not fail on IOs but simply skipped?
Regards
Fabian
Post by Andrew Premdas
Thats what its supposed to do. Cucumber is not designed to allow you to
skip steps and continue, because generally scenarios don't make sense when
you skip steps.
e.g
Given I login
When I view my profile
doesn't make sense/work if you skip the login bit.
Post by Samar Mukherjee
Hi,
Can any one tell me how I can skip any step execution and in report it
should come in blue as it comes for skipped steps. I was trying to send
throw new PendingException() but it is actually skipping all the steps
beyond that which means it is actually skipping the remaining part of the
scenario.
Regards,
Samar
--
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
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
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.
Loading...