I'm using Cucumber for my tests. How do I rerun only the failed tests?
相关问题
- I receive the error: cannot find module 'cucum
- Port of the Rails app when running Cucumber tests
- Getting scenario and steps undefined in cucumber w
- How to output Cucumber background steps before eac
- How do I close() and quit() Selenium driver withou
相关文章
- How do you run cucumber with Scala 2.11 and sbt 0.
- How to pass multiple parameter to Cucumber Runner
- Cucumber not serializing date string from datatabl
- selenium grid with cucumber
- How to get scenario name from a scenario outline i
- Handling excel spreadsheets with Cucumber Scenario
- Can you define instance variables during Cucumber&
- Guardfile for running single cucumber feature in s
Run Cucumber with rerun formatter:
It will output locations of all failed scenarios to this file.
Then you can rerun them by using
Here is my simple and neat solution.
Step 1: Write your cucumber java file as mentioned below with
rerun:target/rerun.txt
. Cucumber writes the failed scenarios line numbers inrerun.txt
as shown below.Later we can use this file in Step 2. Name this file as
MyScenarioTests.java
. This is your main file to run your tagged scenarios. If your scenarios has failed test cases,MyScenarioTests.java
will write/mark themrerun.txt
under target directory.Step 2: Create another scenario file as shown below. Let's say this as
FailedScenarios.java
. Whenever you notice any failed scenario run this file. This file will usetarget/rerun.txt
as an input for running the scenarios.Everytime if you notice any failed scenarios run the file in Step 2
You need at least version 1.2.0 in order to use the @target/rerun.txt new feature. After that just create a runner that runs at the end and uses this file. Also, if you are using Jenkins, you can put a tag on the random failures features so the build doesn't fails unless after being ran twice.