@@ -201,7 +201,8 @@
|
||||
<GroupBox Header="Output"
|
||||
Margin="3"
|
||||
Grid.Row="2">
|
||||
<TextBox IsReadOnly="True" />
|
||||
<TextBox IsReadOnly="True"
|
||||
Text="{Binding Output}"/>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace xunit.runner.wpf.ViewModel
|
||||
{
|
||||
@@ -134,6 +135,13 @@ namespace xunit.runner.wpf.ViewModel
|
||||
set { Set(ref currentRunState, value); }
|
||||
}
|
||||
|
||||
private string output = string.Empty;
|
||||
public string Output
|
||||
{
|
||||
get { return output; }
|
||||
set { Set(ref output, value); }
|
||||
}
|
||||
|
||||
public string FilterString
|
||||
{
|
||||
get { return searchQuery.SearchString; }
|
||||
@@ -295,7 +303,19 @@ namespace xunit.runner.wpf.ViewModel
|
||||
{
|
||||
var testCase = testCases.Single(tc => tc.DisplayName == testFailed.TestCase.DisplayName);
|
||||
testCase.State = TestState.Failed;
|
||||
TestFinished?.Invoke(this, TestStateEventArgs.Failed);
|
||||
var resultString = new StringBuilder(testFailed.TestCase.DisplayName);
|
||||
resultString.AppendLine(" FAILED:");
|
||||
for (int i = 0; i < testFailed.ExceptionTypes.Length; i++)
|
||||
{
|
||||
resultString.AppendLine($"\tException type: '{testFailed.ExceptionTypes[i]}', number: '{i}', parent: '{testFailed.ExceptionParentIndices[i]}'");
|
||||
resultString.AppendLine($"\tException message:");
|
||||
resultString.AppendLine(testFailed.Messages[i]);
|
||||
resultString.AppendLine($"\tException stacktrace");
|
||||
resultString.AppendLine(testFailed.StackTraces[i]);
|
||||
}
|
||||
resultString.AppendLine();
|
||||
|
||||
TestFinished?.Invoke(this, TestStateEventArgs.Failed(resultString.ToString()));
|
||||
return !isCancelRequested();
|
||||
}
|
||||
|
||||
@@ -390,6 +410,7 @@ namespace xunit.runner.wpf.ViewModel
|
||||
TestsFailed = 0;
|
||||
TestsSkipped = 0;
|
||||
CurrentRunState = TestState.NotRun;
|
||||
Output = string.Empty;
|
||||
await Task.Run(() => RunTestsInBackground());
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -440,6 +461,7 @@ namespace xunit.runner.wpf.ViewModel
|
||||
break;
|
||||
case TestState.Failed:
|
||||
TestsFailed++;
|
||||
Output = Output + e.Results;
|
||||
break;
|
||||
case TestState.Skipped:
|
||||
TestsSkipped++;
|
||||
|
||||
@@ -4,14 +4,16 @@ namespace xunit.runner.wpf.ViewModel
|
||||
{
|
||||
public class TestStateEventArgs : EventArgs
|
||||
{
|
||||
public static TestStateEventArgs Failed { get; } = new TestStateEventArgs(TestState.Failed);
|
||||
public static TestStateEventArgs Failed(string results) => new TestStateEventArgs(TestState.Failed, results);
|
||||
public static TestStateEventArgs Passed { get; } = new TestStateEventArgs(TestState.Passed);
|
||||
public static TestStateEventArgs Skipped { get; } = new TestStateEventArgs(TestState.Skipped);
|
||||
private TestStateEventArgs(TestState state)
|
||||
private TestStateEventArgs(TestState state, string results = null)
|
||||
{
|
||||
this.State = state;
|
||||
this.Results = results;
|
||||
}
|
||||
|
||||
public TestState State { get; }
|
||||
public string Results { get; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user