# How can I run a test case multiple times and store the results in the same log file

**URL:** <https://forum.robotframework.org/t/how-can-i-run-a-test-case-multiple-times-and-store-the-results-in-the-same-log-file/3877>\
**Category:** Robot Framework\
**Created:** [25 May 2022 08:48 UTC](https://forum.robotframework.org/t/how-can-i-run-a-test-case-multiple-times-and-store-the-results-in-the-same-log-file/3877 "2022-05-25T08:48:04Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [26 May 2023 00:49 UTC](https://forum.robotframework.org/t/how-can-i-run-a-test-case-multiple-times-and-store-the-results-in-the-same-log-file/3877/8 "2023-05-26T00:49:12Z")

</div>

Hi Adam,

Not sure, you probably found your solution already?

If you want a more reactive approach, it’s also possible to do this with a listener, I built a listener to rerun the same test 5 times, but you’d probably want to change it’s logic to run if result was fail which should be easy enough to do.

The details of my listener (and full working example) are in this thread (below), thanks to @pekkaklarck who helped me a lot to figure that out

> [@Can I run Setup, Test and Teardown separately?](https://forum.robotframework.org/t/can-i-run-setup-test-and-teardown-separately/3878/12):
>
> You need to use v3 listeners for this. In the end\_test method you ought to be able to use something like this to create a new test: new = test.parent.tests.create(name='New test') new.body.create\_keyword(name='Log', args=['Example']) Or something like this to copy an existing test: copy = test.copy(name='New name') test.parent.tests.append(copy) Same stuff works also with modifiers. You are working with same model objects in both cases.

Dave.

---

_[View the full topic](https://forum.robotframework.org/t/how-can-i-run-a-test-case-multiple-times-and-store-the-results-in-the-same-log-file/3877)._
