Click or drag to resize

Test Case Exception

Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException was unhandled by user code

Problem

Test case does not run to the end.

Example of exception message:

Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException was unhandled by user code
  HResult=-2146233088
  Message=Fehler bei "Assert.Fail". 
  Source=Microsoft.VisualStudio.QualityTools.UnitTestFramework
  StackTrace:
       bei Microsoft.VisualStudio.TestTools.UnitTesting.Assert.HandleFailure(String assertionName, String message)
       bei Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Fail(String message)
       bei SIC.Test.Helper.Log.Result()
Reason

Eventually a command will be used that is not stable in the test environment.

For example: The DateTime.Now.ToString() command triggers this exception.

Solution

Check the test case for these commands and replace them.

For example: DateTime.Now.ToString() replace with this.Log.GetTimeStamp