DEV Community

Cover image for Rerun only Failed Tests in Robot Framework
Pauline-momanyi
Pauline-momanyi

Posted on

Rerun only Failed Tests in Robot Framework

Sometimes correctly written test cases can fail in robot framework. This could be caused by a couple of reasons including but not limited to:

  • Network failures - leading to a time out
  • Software failures

In such a case, there arises a need to rerun only the failed test cases and generate a report that combines the results. Sit tight as I guide you on how to do this (and become a master in 4 seconds 😄)

1. Run Your Tests

Let’s use a simple sample robot project as below. There are 3 test cases in TC1.robot.

Image description

After running the tests, assume one test case fails due to a network error as below:

Image description

Image description

2. Rerun the Failed Test Case

To rerun only the failed test cases, run the command:

robot --rerunfailed output.xml --output output2.xml TC1.robot

output.xml is the output of our first run, while output2.xml is where we want to store the output of our second run.

Image description

Only the one failed test case has been run

3. Combine the outputs

To combine the two runs and have a combined report, run the command:

rebot --output output.xml --merge output*.xml

Image description

Image description

Yehey, ☺️ , simple, right?

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs