Skip to content

Instantly share code, notes, and snippets.

@yaniviny
Last active July 20, 2017 09:11
Show Gist options
  • Save yaniviny/04f60665c18d614ac797faad8cfb0b3f to your computer and use it in GitHub Desktop.
Save yaniviny/04f60665c18d614ac797faad8cfb0b3f to your computer and use it in GitHub Desktop.
Shows how PractiTest computes the run status of a test run
def compute_status
statuses = all_statuses.uniq - ['N/A'] #take all statuses, make them unique, remove 'N/A'
if statuses.include?("FAILED") #if you have FAILED, everything is FAILED
"FAILED"
elsif statuses.include?("BLOCKED") # otherwise, if you have BLOCKED, everything is set to BLOCKED
"BLOCKED"
elsif (statuses == ["NO RUN"]) || statuses.empty? # IF YOU HAVE "NO RUN", or don't have steps at all -> It should be no run
"NO RUN"
elsif statuses == ["PASSED"] #if you're left with only one status -> PASSED, it means that all steps are passed (we already did unique, remember?)
"PASSED"
else
"NOT COMPLETED" #otherwise, it's NOT COMPLETED
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment