[Bug-Fix] Capture exception throw failures.


While doing some testing it was noticed that if a Test expected an exception, but that exception wasn't thrown the test would still pass. (This was noticed on a function that either throws or returns true.) Fixing this helped track down some issues with the script under test that the tests incorrectly showed as 'Pass'.
To fix this the following change was made in PSUnit.Run.ps1 line 196:
  $FunctionOutput = Execute-Test $_
  if ( $ExpectedExceptionTypeName -ne "ExpectedException Parameter is not defined in function $($CurrentFunction.Name)") {
throw (New-Object System.InvalidOperationException "Failed to throw an exception!`nExpected `"$ExpectedExceptionTypeName`"" )
  Report-TestResult -Test $CurrentFunction -Result "PASS"
Closed Jan 6, 2010 at 7:06 AM by senf
Fixed in revision 36556.


senf wrote Dec 22, 2009 at 6:21 PM

Thanks for reporting this issue. I will include your suggested fix in the next check-in.

wrote Dec 22, 2009 at 6:22 PM

wrote Dec 22, 2009 at 6:23 PM

wrote Jan 6, 2010 at 7:06 AM

wrote Feb 14, 2013 at 2:40 AM

wrote May 16, 2013 at 8:35 AM