Help need to execute my rerun failed scenarios

623 views
Skip to first unread message

sai krishna

unread,
Jun 1, 2014, 4:22:39 AM6/1/14
to cu...@googlegroups.com
Hi Folks,

I was able to create a rerun.txt which contains all failed features. Now how do i execute this immediatly without making any changes to my cucumber.yml file or by specifying the rerun.txt on command line .


For example :

Once all my tests run and if there is a failure i would want my script to rerun the failed scenarios stored .

Can someone pls help me on this ?

Tomáš Knězek

unread,
Jun 2, 2014, 3:30:56 AM6/2/14
to cu...@googlegroups.com
What exactly do you have stored in you txt file?

I don't know what technology you use, but I can imagine that if you have every scenario tagged with unique tag and if you're able to store failed scenarios tags instead of scenario titles, than you can make some after suite hook function or method where you can iterate trough you txt file and for each failed scenario execute windows command containing actual scenario tag.

I hope it is understandable :-)

Dne neděle, 1. června 2014 10:22:39 UTC+2 sai krishna napsal(a):

aslak hellesoy

unread,
Jun 2, 2014, 6:55:58 AM6/2/14
to Cucumber Users
On Mon, Jun 2, 2014 at 2:30 AM, Tomáš Knězek <tomas....@gmail.com> wrote:
What exactly do you have stored in you txt file?

I don't know what technology you use, but I can imagine that if you have every scenario tagged with unique tag and if you're able to store failed scenarios tags instead of scenario titles, than you can make some after suite hook function or method where you can iterate trough you txt file and for each failed scenario execute windows command containing actual scenario tag.
 
I hope it is understandable :-)

I think I understand what you mean. It's bad advise to have Cucumber run Cucumber - it would run scenarios indefinitely.

Tomáš - what Cucumber are you using? (ruby, jvm, js).

Aslak
 

Dne neděle, 1. června 2014 10:22:39 UTC+2 sai krishna napsal(a):
Hi Folks,

I was able to create a rerun.txt which contains all failed features. Now how do i execute this immediatly without making any changes to my cucumber.yml file or by specifying the rerun.txt on command line .


For example :

Once all my tests run and if there is a failure i would want my script to rerun the failed scenarios stored .

Can someone pls help me on this ?

--
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tomáš Knězek

unread,
Jun 2, 2014, 8:17:14 AM6/2/14
to cu...@googlegroups.com
I use behat/mink/selenium.

And yes...you're right about the infinite run...I knew about that but forgot to write it. But this issue can be solved by some incrementation of some variable and condition. But I don't think this problem can be solved by some standard approach. When scenarios fail they fail...that's the nature of running tests. But I have encountered issue that sometimes tests fail from some random reason or timeout and during second run everything is OK so I can imagine Sai's problem. Especially when tests are executed during some night building process.

Do you have any idea Aslak?

I am not actually dealing with this issue on my environment but I am pretty sure that this will also happen to me in the future and I will need to deal with it. So I'll welcome any "more standard" ideas or solutions.

Regards
Tom

Dne pondělí, 2. června 2014 12:55:58 UTC+2 Aslak Hellesøy napsal(a):

aslak hellesoy

unread,
Jun 2, 2014, 9:36:35 AM6/2/14
to Cucumber Users
On Mon, Jun 2, 2014 at 7:17 AM, Tomáš Knězek <tomas....@gmail.com> wrote:
I use behat/mink/selenium.

And yes...you're right about the infinite run...I knew about that but forgot to write it. But this issue can be solved by some incrementation of some variable and condition. But I don't think this problem can be solved by some standard approach. When scenarios fail they fail...that's the nature of running tests. But I have encountered issue that sometimes tests fail from some random reason or timeout and during second run everything is OK so I can imagine Sai's problem. Especially when tests are executed during some night building process.

Do you have any idea Aslak?

I am not actually dealing with this issue on my environment but I am pretty sure that this will also happen to me in the future and I will need to deal with it. So I'll welcome any "more standard" ideas or solutions.


Cucumber(-Ruby) can parse the contents of rerun.txt:

    cucumber @rerun.txt

Off the top of my head no other Cucumber implementations support this.
I'd love to come up with a standard for specifying what scenarios/tests to run.

The standard would define a file format and a way to tell the tool about this file. I think the format implicitly defined by rerun.txt is fine.
Telling the tool to run those could be done like Cucumber-Ruby does it - prefix the file with @.

Thoughts?

Aslak

Björn Rasmusson

unread,
Jun 3, 2014, 2:35:54 PM6/3/14
to cu...@googlegroups.com
Aslak Hellesøy wrote:



On Mon, Jun 2, 2014 at 7:17 AM, Tomáš Knězek <tomas....@gmail.com> wrote:
I use behat/mink/selenium.

And yes...you're right about the infinite run...I knew about that but forgot to write it. But this issue can be solved by some incrementation of some variable and condition. But I don't think this problem can be solved by some standard approach. When scenarios fail they fail...that's the nature of running tests. But I have encountered issue that sometimes tests fail from some random reason or timeout and during second run everything is OK so I can imagine Sai's problem. Especially when tests are executed during some night building process.

Do you have any idea Aslak?


How about capture the exit code from the cucumber execution, and if non-zero use the content of rerun.txt to execute the failed scenarios a second time.
 
I am not actually dealing with this issue on my environment but I am pretty sure that this will also happen to me in the future and I will need to deal with it. So I'll welcome any "more standard" ideas or solutions.


Cucumber(-Ruby) can parse the contents of rerun.txt:

    cucumber @rerun.txt

Cucumber implementations that support the [FILE[:LINE[:LINE]*] syntax for specifying which features/scenarios to run should be able to use commands similar to:

    cucumber `cat return.txt`

to execute the failed scenarios, if of course not using Cucumber(-Ruby) which support the @rerun.txt syntax.

Best Regards
Björn

Tomáš Knězek

unread,
Jun 4, 2014, 2:22:12 AM6/4/14
to cu...@googlegroups.com
But this could also cause infinite run, which was our initial problem if I'm not mistaken, so some kind of maximal rerun count condition must be handled. So if you check that the file with failed scenarios is not empty or that the result is non-zero, it does not solve the infinite run issue. But I gues the original Sai's question was already answered.

Dne úterý, 3. června 2014 20:35:54 UTC+2 Björn Rasmusson napsal(a):

sai krishna

unread,
Jun 12, 2014, 9:47:39 AM6/12/14
to cu...@googlegroups.com
nope my issue is not resolved, my code is getting into infinite loop for rerun scenario 

i write my code this way 

at_exit do
  path= File.absolute_path("rerun.txt")
path_apk=File.absolute_path("com.debug.apk")
if File.exist?(path)
#rewrite
puts 'calabash-android run ' + path_apk + ' -p rerun LOGIN=qwerty'
system('calabash-android run ' + path_apk + ' -p rerun LOGIN=qwerty')
else
puts 'not in loop'
  end

end


it keeps in getting in the loop even after it runs the rerun.txt file .Can someone help me run this block only once please .

Tominek

unread,
Jun 16, 2014, 3:55:34 AM6/16/14
to cu...@googlegroups.com
Hi Sai,

I'm not familiar with your programming language, so I will try to summarize the issue and guess whats happening.

1. In your code you're gathering scenarios which have failed to some rerun.txt
2. After the tests are done, you check if rerun.txt exists (Do you delete the file afterwards?)
3. If the scenarios are "reruned" do you still gathering failed to rerun.txt? And after rerun do you again execute rerun.txt scenarios? (This could cause infinite run)

In one of my previous posts I wrote that you must somewhere remember, that you have already executed rerun so it will not be executed more times than you want. Are you doing this somehow?

Regards
Tom

Dne čtvrtek, 12. června 2014 15:47:39 UTC+2 sai krishna napsal(a):
Reply all
Reply to author
Forward
0 new messages