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?

AWS Q Developer image

Build your favorite retro game with Amazon Q Developer CLI in the Challenge & win a T-shirt!

Feeling nostalgic? Build Games Challenge is your chance to recreate your favorite retro arcade style game using Amazon Q Developer’s agentic coding experience in the command line interface, Q Developer CLI.

Participate Now

Top comments (0)

Tiger Data image

🐯 🚀 Timescale is now TigerData: Building the Modern PostgreSQL for the Analytical and Agentic Era

We’ve quietly evolved from a time-series database into the modern PostgreSQL for today’s and tomorrow’s computing, built for performance, scale, and the agentic future.

So we’re changing our name: from Timescale to TigerData. Not to change who we are, but to reflect who we’ve become. TigerData is bold, fast, and built to power the next era of software.

Read more