Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Feature to execute failed tests only #1190

Open
chun2014 opened this issue Aug 13, 2014 · 95 comments
Open

Feature to execute failed tests only #1190

chun2014 opened this issue Aug 13, 2014 · 95 comments

Comments

@chun2014
Copy link

As a end to end testing framework, it would be nice if Protractor provide a way to execute failed tests only from test suite(s) run.

@juliemr
Copy link
Member

juliemr commented Aug 18, 2014

Sounds nice - this would require integration with the test runner (Jasmine, Mocha, etc) and I'm not sure how it would know which ones failed before (it would have to store state somewhere). It's not likely that this will be added soon, but it's a neat idea.

@juliemr juliemr added this to the Icebox milestone Sep 23, 2014
@zarroba
Copy link

zarroba commented Oct 1, 2014

Maybe it could use the previous xunit report or any other report format as input to know which tests failed in the previous execution...

@nuweb
Copy link

nuweb commented Oct 17, 2014

I have the same problem with some tests, they pass most times, but fail sometimes, so it would be nice feature to have protractor retry those failed tests.

@iamisti
Copy link

iamisti commented Dec 31, 2014

have the same problem. I'm looking forward this feature!
Do anybody knows when it will be ready-to-use?

@jlin412
Copy link

jlin412 commented Dec 31, 2014

+1

1 similar comment
@alecxe
Copy link
Contributor

alecxe commented Dec 31, 2014

+1

@hankduan
Copy link
Contributor

hankduan commented Jan 7, 2015

Can you clarify which of the following use cases is the one you want?

  1. Automatically rerun failed tests as part of the initial protractor run to deflake. i.e.
> protractor config.js --retry-failed
running...A,B,D passed, C,E failed
running C,E again...C passed, E failed
running E again...E passed
  1. Manually rerun failed tests after edits. i.e.
> protractor config.js
running...A,B,D passed, C,E failed
> vim test.js // try to fix C and E
> protractor config.js --run-last-failed
running only C,E...C passed, E failed
> vim test.js // try to fix E
> protractor config.js --run-last-failed
running only E...E passed

@iamisti
Copy link

iamisti commented Jan 7, 2015

the first one, so "1) Automatically rerun failed tests as part of the initial protractor run to deflake"
Also it would be nice if there would be a configurable value for the maximum retry count.
e.g.: in your example there was a 2 re-run, if you set the limit to 1 then the last one won't run.

I hope it was clear.

@galxy25
Copy link

galxy25 commented Jan 23, 2015

@hankduan @iamisti The first one for sure! In my case, when running tests on a CI server, having to redo an entire build/push because of a test timing out is frustrating.

@vladradz
Copy link

+1 for first one

@papucho
Copy link

papucho commented Feb 16, 2015

+1

1 similar comment
@willgm
Copy link

willgm commented Feb 16, 2015

+1

@robertoronderosjr
Copy link

+1, any updates on this?

@hankduan
Copy link
Contributor

Not right now, but considering the big feedback, I'll see if I can do something about it in the near future

@hankduan hankduan self-assigned this Feb 20, 2015
@iamisti
Copy link

iamisti commented Feb 21, 2015

Please do it as soon as possible. This is almost the most important feature that we're missing from it.

@ruimarques
Copy link

+1

1 similar comment
@jlin412
Copy link

jlin412 commented Mar 2, 2015

+1

@sanjeevmajgotra
Copy link

+1, must have feature. have a suite of 1300+ TCs, 15~20 are failing and in teamcity and causing build failure, all are passing if running individually.

@ericmdantas
Copy link

👍

@sanjeevmajgotra
Copy link

Hi @hankduan , could you please let me know possible ETA for this feature. I need to decide whether i should have a workaround implemented or wait for this implementation from protractor team.

@hankduan
Copy link
Contributor

hankduan commented Mar 3, 2015

Likely some time between 1-2 months. I'm trying to get to it as soon as possible, but there are a few other pressing issues that are ahead of this.

@ericedem
Copy link

ericedem commented Mar 4, 2015

We desparately need a way to retry tests in our pipeline, as we have reached critical mass of 100+ tests where likely one will fail. Is there an alternative workaround for retries, or is this the only way? @hankduan

@hankduan
Copy link
Contributor

hankduan commented Mar 4, 2015

You would need write a script to retry from a top level. (i.e. examine the output which test passed failed, and retry those --using grep). This is probably the approach I'll need to take (well, without the script part) when I do start investigating a way to do this, as there is no way for protractor to tell jasmine or mocha to retry a test directly.

@ericedem
Copy link

ericedem commented Mar 4, 2015

hmm ok I was actually thinking about doing something like this myself. I might hack something together as a proof of concept to solve our immediate needs.

@gkohen
Copy link
Contributor

gkohen commented Jul 12, 2016

@premkh9, are you using gulp? If so I suggest using protractor flake mentioned above:
https://www.npmjs.com/package/protractor-flake

@bvasilchik
Copy link

I've actually had to make a script that finds all the failures and re-runs them because there is sometimes one or two that fail but it was just a matter of communication with a service like browserstack or saucelabs taking too long or some other factor that wasn't a real positive failure.

@vcernomschi
Copy link

Protractor-flake resolved this issue for me.

@premkh9
Copy link

premkh9 commented Jul 12, 2016

@gkohen, can you please help me how to implement protractor flake in protractor configuration file. I am not using gulp.

@koreyba
Copy link

koreyba commented Sep 7, 2016

+1

@longlho
Copy link

longlho commented Sep 8, 2016

if u guys are using Mocha, it already has retry

@lalau
Copy link

lalau commented Sep 8, 2016

@longlho

Mocha's retry is mostly good, but there are still some issues:

  1. It continues the test case even it encounters a failure, and retry after the whole test case has finished. It should stop and retry as soon as it encounters a failure to save time. It is especially important to test cases that involve a longer sequence of actions.
  2. It doesn't handle failures thrown in beforeEach, including both things like browser.wait timeouts and expect. I probably don't use expect at all in beforeEach, but I use browser.wait a lot in beforeEach to make sure each test starts with the same common conditions. It would be great if it can support that.

@premkh9
Copy link

premkh9 commented Sep 8, 2016

can someone please help me how to implement protractor flake in protractor configuration file. I am not using gulp.

@brunofracalossi
Copy link

+1

1 similar comment
@pix27
Copy link

pix27 commented Sep 21, 2016

+1

@premkh9
Copy link

premkh9 commented Oct 11, 2016

@juliemr @NickTomlin - Its really hard to configure protractor flakes from following documentation. Can you please explain in detail, It would be really helpful to many of them

https://www.npmjs.com/package/protractor-flake

@NickTomlin
Copy link
Contributor

@premkh9 if you have an issue please raise it on the protractor flake repository. Protractor flake is not an official angular/protractor project.

@philipb4u
Copy link

Re running a failed tests are very useful feature for the frame work perspective. I tried flake but It did not help. Can you please suggest any other way to achieve this.

@meizzhou
Copy link

meizzhou commented Dec 2, 2016

+1

@qualityshepherd
Copy link

qualityshepherd commented Dec 3, 2016

For folks having trouble setting up protractor-flake, I've added it to my protractor-example tests on GitHub. Take a look at the flake file, which I use to kick off tests... eg. ./flake conf.js.

You could also always use it directly... for example, assuming you have protractor-flake installed as a dev dependency (--save-dev), you could then run it with node_modules/.bin/protractor-flake -- conf.js.

@sjelin
Copy link
Contributor

sjelin commented Dec 22, 2016

We could do this in jasminewd - no way to do this directly in protractor though. If you need this for mocha or cucumber you'll have to ask them for this feature.

Jasmine wd issue: angular/jasminewd#73

@irushah
Copy link

irushah commented Jan 25, 2017

+1

3 similar comments
@thangakumard
Copy link

+1

@anudeep-mj
Copy link

+1

@ajaysuwalka
Copy link

+1

@espekkaya
Copy link

espekkaya commented Jan 31, 2018

Hello,
I have just found a library. I think it solves our problem.
Protractor-retry

@daniell0gda
Copy link

Hello,
I have just found a library. I think it solves our problem.
Protractor-retry

"Windows as an environment to launch & use this package is unfortunately not yet supported."

@GYuriy
Copy link

GYuriy commented Jul 26, 2019

+1

@Juani-Canete-zz
Copy link

Juani-Canete-zz commented Jan 7, 2020

This is an older issue, but if you are looking for this, you can achieve this using different npm packages, I'm using:

https://www.npmjs.com/package/protractor-flake

I've changed some stuff because I'm using typescript, and when a test fails protractor shows the trace for typescript files, and flake looks the trace in order to rerun failed tests, so you need to point to transpiled JS files in order to be able to rerun failed tests, but should be pretty straightforward the implementation.

@Juani-Canete-zz
Copy link

Also works out of the box with windows/mac/linux we are using it in a cross-platform development team (=

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests