#Handling failed test reports

1 messages · Page 1 of 1 (latest)

gloomy berry
#

Hello! I was wondering what the best approach is for handling tests outputs when the tests fail. Essentially, the tests will output a junit file that I would like to export so that it can be visualised in other tools. However, when tests fail, the entire pipeline fails and I cannot export the file.

One approach I figured would work is to do something like:
.with_exec(["sh", "-c", "pytest --junitxml='./report.xml' tests/ || true"])

Then, viewing the file and inspecting the report.xml to determine if there was a failure. Is there a better approach? I was not able to find anything in the documentation describing test report generation.

Loving dagger and thanks for any assistance!

wheat lodge
fallow dock
#

There's a similar requirement in #1111300802338881646 message. You can also save the exit code in a file if you need to analyze it later: pytest ...; echo $? > /exit_code. Downside with these is that you'll get a cached failure.