Skip to content

Commit 983d18a

Browse files
committed
Fail pipeline if test results file is missing
This will make sure that the pipeline will not report success if for some reason the test results file is not generated. Issue #580
1 parent 0d8259f commit 983d18a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

azure-pipelines.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ stages:
4444
- script: |
4545
docker create --name build-container build-image
4646
docker cp build-container:./app/CSharpFunctionalExtensions.Tests/TestResults ./testresults
47+
48+
# This will make sure that the pipeline fails if the tests were not executed for any reason
49+
if [ ./testresults/testresults.trx ] && [ $(grep -E "<UnitTestResult" ./testresults/testresults.trx -c) -gt 0 ]; then
50+
echo "Test results results found"
51+
else
52+
echo "No test results found"
53+
exit 1
54+
fi
4755
displayName: Extract test results
4856
4957
- task: PublishTestResults@2

0 commit comments

Comments
 (0)