Skip to content

Exporting the test failure reason in VDTESTING_FAILURE_REASON #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ You can also run this step directly with [Bitrise CLI](https://github.com/bitris
| Environment Variable | Description |
| --- | --- |
| `VDTESTING_DOWNLOADED_FILES_DIR` | The directory containing the downloaded files if you have set `directories_to_pull` and `download_test_results` inputs above. |
| `VDTESTING_FAILURE_REASON` | A string containing the outcome and if the test failed. This can be any of these possible values: Crashed, NotInstalled, OtherNativeCrash, TimedOut, UnableToCrawl. Default value None if unable to triage the failure result. |
</details>

## 🙋 Contributing
Expand Down
18 changes: 13 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,31 @@ func main() {
outcome = colorstring.Green(outcome)
case "failure":
successful = false
failureReason := "None"

if step.Outcome.FailureDetail != nil {
if step.Outcome.FailureDetail.Crashed {
outcome += "(Crashed)"
failureReason = "Crashed"
}
if step.Outcome.FailureDetail.NotInstalled {
outcome += "(NotInstalled)"
failureReason = "NotInstalled"
}
if step.Outcome.FailureDetail.OtherNativeCrash {
outcome += "(OtherNativeCrash)"
failureReason = "OtherNativeCrash"
}
if step.Outcome.FailureDetail.TimedOut {
outcome += "(TimedOut)"
failureReason = "TimedOut"
}
if step.Outcome.FailureDetail.UnableToCrawl {
outcome += "(UnableToCrawl)"
failureReason = "UnableToCrawl"
}
outcome += "(" + failureReason + ")"
}

if err := tools.ExportEnvironmentWithEnvman("VDTESTING_FAILURE_REASON", outcome); err != nil {
log.Warnf("Failed to export environment (VDTESTING_FAILURE_REASON), error: %s", err)
}

outcome = colorstring.Red(outcome)
case "inconclusive":
successful = false
Expand Down
7 changes: 6 additions & 1 deletion step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -437,4 +437,9 @@ outputs:
opts:
title: "Downloaded files directory"
description: "The directory containing the downloaded files if you have set `directories_to_pull` and `download_test_results` inputs above."
summary: "The directory containing the downloaded files if you have set `directories_to_pull` and `download_test_results` inputs above."
summary: "The directory containing the downloaded files if you have set `directories_to_pull` and `download_test_results` inputs above." - VDTESTING_DOWNLOADED_FILES_DIR:
- VDTESTING_FAILURE_REASON:
opts:
title: "Failure reason for the UI tests"
description: "A string containing the outcome and if the test failed."
summary: "A string containing the outcome and if the test failed. This can be any of these possible values: Crashed, NotInstalled, OtherNativeCrash, TimedOut, UnableToCrawl. Default value None if unable to triage the failure result."