Skip to content
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

Reporter fail exception fix #150

Merged
merged 3 commits into from
May 17, 2014
Merged
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
4 changes: 3 additions & 1 deletion src/canopy/configuration.fs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module canopy.configuration
open reporters
open System

//runner related
let failFast = ref false
let failScreenshotPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\canopy\"

let mutable chromeDir = @"c:\"
let mutable ieDir = @"c:\"
Expand All @@ -16,4 +18,4 @@ let mutable reporter : IReporter = new ConsoleReporter() :> IReporter
let mutable disableSuggestOtherSelectors = false
let mutable autoPinBrowserRightOnLaunch = true
let mutable throwIfMoreThanOneElement = false
let mutable configuredFinders = finders.defaultFinders
let mutable configuredFinders = finders.defaultFinders
21 changes: 14 additions & 7 deletions src/canopy/runner.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ open configuration
open canopy
open reporters
open types
open OpenQA.Selenium

let rec private last = function
| hd :: [] -> hd
Expand Down Expand Up @@ -47,13 +48,19 @@ let pass () =
reporter.pass ()

let fail (ex : Exception) id =
if failFast = ref true then failed <- true
failedCount <- failedCount + 1
contextFailed <- true
let p = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\canopy\"
let f = DateTime.Now.ToString("MMM-d_HH-mm-ss-fff")
let ss = screenshot p f
reporter.fail ex id ss
try
if failFast = ref true then failed <- true
failedCount <- failedCount + 1
contextFailed <- true
let f = DateTime.Now.ToString("MMM-d_HH-mm-ss-fff")
let ss = screenshot configuration.failScreenshotPath f
reporter.fail ex id ss
with
| :? WebDriverException as failExc ->
//Fail during error report (likely OpenQA.Selenium.WebDriverException.WebDriverTimeoutException ).
// Don't fail the runner itself, but report it.
reporter.write (sprintf "Error during fail reporting: %s" (failExc.ToString()))
reporter.fail ex id null

let run () =
reporter.suiteBegin()
Expand Down