# \--rerunfailedtest with xunit file in Azure pipeline

**URL:** <https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967>\
**Category:** Robot Framework\
**Created:** [7 June 2022 14:30 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967 "2022-06-07T14:30:07Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoostW](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/joostw/32/3778_2.png) [@JoostW](https://forum.robotframework.org/u/JoostW)\
**Post date:** [7 June 2022 14:30 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/1 "2022-06-07T14:30:07Z")

</div>

Hi,

Is there a way to use a cmd or powershell command in the Azure build pipeline  
Expected result of the command is:  
rerun the failed testcases as a task (cmd or Powershell) in the Azure pipeline and merge the output files (xml) with initial outputxunit.xml and the output2 file.

See the example below.

Azure is using -x (xunit) to interpret the output

I use the following command

robot -x outputxunit TC\*.robot | robot --rerunfailed outputxunit.xml -x output2.xml TC\*.robot | rebot --output outputxunit.xml --merge outputxunit.xml output2.xml

the Error message is:  
[ERROR] Reading XML source ‘outputxunit.xml’ failed: Incompatible root element ‘testsuite’.

Does anyone have an idea?

Thanks  
Joost

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [8 June 2022 08:55 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/2 "2022-06-08T08:55:13Z")

</div>

I would try to not use pipe to rebot, but instead to use a real file.

---

<div class="post-metadata">

**Author:** ![JoostW](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/joostw/32/3778_2.png) [@JoostW](https://forum.robotframework.org/u/JoostW)\
**Post date:** [9 June 2022 08:49 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/3 "2022-06-09T08:49:38Z")

</div>

like an input xml file?

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [9 June 2022 09:17 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/4 "2022-06-09T09:17:16Z")

</div>

Yes, instead of one command like you have with piping the input to rebot, you would redirect to a new xml file, and then in another command use it for rebot.

---

<div class="post-metadata">

**Author:** ![Piotr](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@Piotr](https://forum.robotframework.org/u/Piotr)\
**Post date:** [21 October 2022 05:45 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/5 "2022-10-21T05:45:19Z")

</div>

Hi, @HelioGuilherme66@JoostW  
Have you manage to fix this ?  
I’ve pasted below my pipline.  
Doesn’t matter what I will write in script **bold** below I always got the same "  
_“[ERROR] Collecting failed tests or tasks from ‘D:\a\1\s\TestOutput\ers\_browser.xml’ failed: Reading XML source ‘D:\a\1\s\TestOutput\ers\_browser.xml’ failed: Incompatible root element ‘testsuite’”_

# Python package

# Create and test a Python package on multiple Python versions.

# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:

# [Build and publish a Python app - Azure Pipelines | Microsoft Learn](https://docs.microsoft.com/azure/devops/pipelines/languages/python)

trigger:

- main

schedules:

- cron: 0 9 \* \* 1-5 # cron syntax defining a schedule  
displayName: ERS UI Automated Tests - browser library # friendly name given to a specific schedule  
branches:  
include: [ERS] # which branches the schedule applies to  
exclude:  
- Geet\_Branch  
- Iza\_branch  
- Piotr\_Branch  
- Tiantian-branch  
- ERS\_Jose # which branches to exclude from the schedule  
- Vehicle\_and\_BrokenUI # which branches to exclude from the schedule  
always: true # whether to always run the pipeline or only if there have bee

jobs:

- job: job  
timeoutInMinutes: 90 # Sets the execution timeout in Azure to 90 min - maximum is 360 min  
pool:  
vmImage: ‘windows-latest’  
strategy:  
matrix:  
Python39:  
python.version: ‘3.10’

---

<div class="post-metadata">

**Author:** ![JoostW](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/joostw/32/3778_2.png) [@JoostW](https://forum.robotframework.org/u/JoostW)\
**Post date:** [21 October 2022 10:12 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/6 "2022-10-21T10:12:42Z")

</div>

Hi Piotr,

I have for now solution. See the yaml below. Error is : [ERROR] Collecting failed tests or tasks from ‘outputxunit.xml’ failed: Reading XML source ‘outputxunit.xml’ failed: No such file or directory

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/0/06fd4969f5e63bbc24147f9d976e90e4939a5c24.png)

---

<div class="post-metadata">

**Author:** ![Piotr](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@Piotr](https://forum.robotframework.org/u/Piotr)\
**Post date:** [21 October 2022 10:51 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/7 "2022-10-21T10:51:08Z")

</div>

@JoostW Basically what you are trying to tell me that your YAML configuration is still doesn’t work, right ?  
But instead of one error you are getting another \>?

---

<div class="post-metadata">

**Author:** ![JoostW](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/joostw/32/3778_2.png) [@JoostW](https://forum.robotframework.org/u/JoostW)\
**Post date:** [21 October 2022 12:53 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/8 "2022-10-21T12:53:15Z")

</div>

@Piotr, yes that’s right, now get another error back.

I found something below: (it says, first there must to by merged the original output xml and use rebot to create xunit from the merged output)

> <https://stackoverflow.com/questions/73697432/robot-framework-pabot-rebot-merge-error-error-reading-xml-source-rep>

---

<div class="post-metadata">

**Author:** ![Piotr](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@Piotr](https://forum.robotframework.org/u/Piotr)\
**Post date:** [23 October 2022 19:29 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/9 "2022-10-23T19:29:53Z")

</div>

Hi @JoostW  
I’ve found answer why we are getting this errors and I repaired my YAML.  
There is very simply reason you can not us XUNIT file as you are doing there  
-x outputxunit.xml you need to create in first run --output outputxunit.xml instead -x  
always use OUTPUT file not Xunit file.  
My pipline now works fine

---

<div class="post-metadata">

**Author:** ![JoostW](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/joostw/32/3778_2.png) [@JoostW](https://forum.robotframework.org/u/JoostW)\
**Post date:** [25 October 2022 06:05 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/10 "2022-10-25T06:05:33Z")

</div>

hi @Piotr, thats nice. How your yaml looks like?

---

<div class="post-metadata">

**Author:** ![JoostW](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/joostw/32/3778_2.png) [@JoostW](https://forum.robotframework.org/u/JoostW)\
**Post date:** [25 October 2022 10:08 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/11 "2022-10-25T10:08:36Z")

</div>

Hi @Piotr, I also found the answer, and the pipeline does what it should do (1st the run, rerun failed TC’s, merge and PublishTestResult), see the example of the yaml below:

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/0/000a48cee281c4f4dd15f9711dcedad661045499.png)

---

<div class="post-metadata">

**Author:** ![Piotr](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@Piotr](https://forum.robotframework.org/u/Piotr)\
**Post date:** [25 October 2022 10:41 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/12 "2022-10-25T10:41:12Z")

</div>

@JoostW  
Can you tell me what is for this part in your Yaml ?

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/5/5976642eb71d76b29681d153c60907f7e64c6bbf.png)

---

<div class="post-metadata">

**Author:** ![Piotr](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@Piotr](https://forum.robotframework.org/u/Piotr)\
**Post date:** [25 October 2022 10:43 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/13 "2022-10-25T10:43:55Z")

</div>

![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/c/c63e87f9ca50780b2df8cc4bc832d966c404bd32.png)

---

<div class="post-metadata">

**Author:** ![JoostW](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/joostw/32/3778_2.png) [@JoostW](https://forum.robotframework.org/u/JoostW)\
**Post date:** [25 October 2022 10:55 UTC](https://forum.robotframework.org/t/rerunfailedtest-with-xunit-file-in-azure-pipeline/3967/14 "2022-10-25T10:55:34Z")

</div>

@Piotr On that line of the yaml, you can move to the root directory  
or another specified PATH, which contains, for example, your robot tests.
