public static TestFailed ( string assemblyName, string message, string details ) : |
||
assemblyName | string | |
message | string | |
details | string | |
Résultat |
private void WriteServerEventFailure(string name, string writeMessage) { const int durationMilliseconds = 0; WrapTestWithStartAndEnd(() => _messageWriter.Write( CommandFactory.TestFailed( name, writeMessage, writeMessage)), name, durationMilliseconds); }
public void Handle(TestCaseResult message) { if (message == null) { throw new ArgumentNullException("message"); } var name = message.FullMethodName(); var durationMilliseconds = message.TimeToComplete.Milliseconds; switch (message.ResultType) { case ResultType.Ignored: WrapTestWithStartAndEnd(CommandFactory.TestIgnored(message.MethodName, string.Empty), message.MethodName, 0); break; case ResultType.Passed: WrapTestWithStartAndEnd(() => { }, name, durationMilliseconds); break; case ResultType.Failed: WrapTestWithStartAndEnd(() => _messageWriter.Write( CommandFactory.TestFailed( name, message.ExceptionInfo.FullMessage, message.ExceptionInfo.FullMessage)), name, durationMilliseconds); break; case ResultType.SystemGeneratedFailure: WrapTestWithStartAndEnd(() => _messageWriter.Write( CommandFactory.TestFailed( name, "StatLight generated test failure", message.OtherInfo)), name, durationMilliseconds); break; default: "Unknown TestCaseResult (to StatLight) - {0}".FormatWith(message.ResultType) .WrapConsoleMessageWithColor(Settings.Default.ConsoleColorError, true); break; } }
public void Handle(TestCaseResultServerEvent message) { if (message == null) { throw new ArgumentNullException("message"); } var name = message.FullMethodName(); var durationMilliseconds = message.TimeToComplete.Milliseconds; switch (message.ResultType) { case ResultType.Ignored: WrapTestWithStartAndEnd(CommandFactory.TestIgnored(message.MethodName, string.Empty), message.MethodName, 0); break; case ResultType.Passed: WrapTestWithStartAndEnd(() => { }, name, durationMilliseconds); break; case ResultType.Failed: var sb = new StringBuilder(); sb.Append("Test Namespace: "); sb.AppendLine(message.NamespaceName); sb.Append("Test Class: "); sb.AppendLine(message.ClassName); sb.Append("Test Method: "); sb.AppendLine(message.MethodName); if (!string.IsNullOrEmpty(message.OtherInfo)) { sb.Append("Other Info: "); sb.AppendLine(message.OtherInfo); } foreach (var metaData in message.Metadata) { sb.Append("{0,-17}".FormatWith(metaData.Classification + ": ")); sb.Append(metaData.Name + " - "); sb.AppendLine(metaData.Value); } sb.AppendLine(message.ExceptionInfo.FullMessage); var msg = sb.ToString(); WrapTestWithStartAndEnd(() => _messageWriter.Write( CommandFactory.TestFailed( name, message.ExceptionInfo.FullMessage, msg)), name, durationMilliseconds); break; case ResultType.SystemGeneratedFailure: WrapTestWithStartAndEnd(() => _messageWriter.Write( CommandFactory.TestFailed( name, "StatLight generated test failure", message.OtherInfo)), name, durationMilliseconds); break; default: "Unknown TestCaseResultServerEvent (to StatLight) - {0}".FormatWith(message.ResultType) .WrapConsoleMessageWithColor(Settings.Default.ConsoleColorError, true); break; } }