21 Commits

Author SHA1 Message Date
Matteo Cominetti 8564d58439 feat: outputs full stack trace and messages 2020-10-31 18:22:15 +00:00
Matteo Cominetti 8d1679bef7 Update README.md 2020-09-28 22:14:20 +01:00
Matteo Cominetti ed266339f2 Update azure-pipelines.yml for Azure Pipelines 2020-09-15 15:20:09 +02:00
Matteo Cominetti cb9c9019f3 Update azure-pipelines.yml for Azure Pipelines 2020-09-15 13:19:47 +02:00
Matteo Cominetti 18583d394d Update README.md 2020-09-15 11:30:54 +01:00
Matteo Cominetti 5c92d08841 updated readme 2020-07-30 19:27:36 +01:00
Matteo Cominetti c0e691e6e9 bump version 2020-07-30 17:13:51 +01:00
Matteo Cominetti bf7fb4d0a4 fixes RemoveAssemblyTestCases 2020-07-30 17:12:45 +01:00
Matteo Cominetti 572ea33edb Update azure-pipelines.yml for Azure Pipelines 2020-07-30 15:32:45 +01:00
Matteo Cominetti b0cab443bb Update azure-pipelines.yml for Azure Pipelines 2020-07-30 15:27:10 +01:00
Matteo Cominetti c572444603 Update azure-pipelines.yml for Azure Pipelines 2020-07-30 15:22:03 +01:00
Matteo Cominetti da4baa6f12 Update azure-pipelines.yml for Azure Pipelines 2020-07-30 14:55:16 +01:00
Matteo Cominetti 81c396dd80 Update azure-pipelines.yml for Azure Pipelines 2020-07-30 14:54:06 +01:00
Matteo Cominetti d12738e609 Merge branch 'master' of github.com:Speckle-Next/xunit.runner.wpf 2020-07-30 14:50:15 +01:00
Matteo Cominetti 2187a6129f bump 2020-07-30 14:49:39 +01:00
Matteo Cominetti 0e2dda20a3 Update azure-pipelines.yml for Azure Pipelines 2020-07-30 14:49:00 +01:00
Matteo Cominetti 39e42e894e bumps version 2020-07-30 14:41:45 +01:00
Matteo Cominetti feecb993dd Update azure-pipelines.yml for Azure Pipelines 2020-07-30 14:39:04 +01:00
Matteo Cominetti c438ba0bc1 Update README.md
added status badge
2020-07-30 14:22:11 +01:00
Matteo Cominetti aba3cf9d92 feat(traits): updated traits selection logic, children with same name no longer selct across different parents 2020-07-13 19:12:34 +01:00
Matteo Cominetti d941a099ca fix(startup-assemblies): check if file exists 2020-07-08 15:13:47 +01:00
8 changed files with 164 additions and 133 deletions
+14 -3
View File
@@ -1,9 +1,20 @@
# xunit.runner.wpf
# speckle.xunit.runner.wpf
[![Build Status](https://teocomi.visualstudio.com/Speckle/_apis/build/status/specklesystems.speckle.xunit.runner.wpf?branchName=master)](https://teocomi.visualstudio.com/Speckle/_build/latest?definitionId=4&branchName=master)
XUnit Gui written in WPF
Fork of [xunit.runner.wpf](https://www.nuget.org/packages/xunit.runner.wpf).
This version, currently in WIP, uses the [AssemblyRunner](xunit.v3.runner.utility) found in xunit.v3.runner.utility to run the tests so that the external dlls are loaded in the same AppDomain.
This fork, uses the [AssemblyRunner](https://github.com/xunit/xunit/blob/main/src/xunit.v3.runner.utility/Runners/AssemblyRunner.cs) of xunit.v3.runner.utility to run the tests so that the external dlls are loaded via reflection in the same AppDomain.
This is necessary when running unit tests of code hosted by external applications (Revit etc).
Coming soon, a xunit runner for Revit.
NuGet package: https://www.nuget.org/packages/speckle.xunit.runner.wpf/
Sample application using it: https://github.com/Speckle-Next/xUnitRevit
Many thanks to all the developers of xunit and xunit.runner.wpf!
Check out our blog post on this 👉 https://speckle.systems/blog/xunitrevit !
+3 -3
View File
@@ -11,14 +11,14 @@ namespace SampleTestAssembly
public class Class1
{
[Fact]
//[Trait("TraitName1", "TraitValue1")]
[Trait("TraitName1", "TraitValue1")]
public void Pass()
{
Thread.Sleep(TimeSpan.FromSeconds(1));
}
[Fact]
//[Trait("TraitName1", "TraitValue2")]
[Trait("TraitName1", "TraitValue2")]
public void Fail()
{
Thread.Sleep(TimeSpan.FromSeconds(2));
@@ -26,7 +26,7 @@ namespace SampleTestAssembly
}
[Fact(Skip = "Testing")]
//[Trait("TraitName2", "TraitValue2")]
[Trait("TraitName2", "TraitValue2")]
public void Skip()
{
Thread.Sleep(TimeSpan.FromSeconds(1));
+7 -6
View File
@@ -4,19 +4,19 @@
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- master
branches:
include:
- master
- refs/tags/*
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
@@ -47,6 +47,7 @@ steps:
publishLocation: 'Container'
- powershell: |
nuget push -ApiKey $env:APIKEY -Source https://api.nuget.org/v3/index.json $(Build.ArtifactStagingDirectory)/**/*.nupkg
If ($env:BRANCH.StartsWith('refs/tags/')) { nuget push -ApiKey $env:APIKEY -Source https://api.nuget.org/v3/index.json $(Build.ArtifactStagingDirectory)/**/*.nupkg }
env:
APIKEY: $(nuget-apikey)
APIKEY: $(nuget-apikey)
BRANCH: $(Build.SourceBranch)
+2 -2
View File
@@ -332,7 +332,7 @@ namespace Xunit.Runners
if (DispatchMessage<ITestAssemblyFinished>(message, messageTypes, assemblyFinished =>
{
OnExecutionComplete?.Invoke(new ExecutionCompleteInfo(assemblyFinished.TestsRun, assemblyFinished.TestsFailed, assemblyFinished.TestsSkipped, assemblyFinished.ExecutionTime));
tcs.TrySetResult("");
}))
@@ -342,7 +342,7 @@ namespace Xunit.Runners
if (DispatchMessage<IDiagnosticMessage>(message, messageTypes, m => OnDiagnosticMessage(new DiagnosticMessageInfo(m.Message))))
return !cancelled;
if (OnTestFailed != null)
if (DispatchMessage<ITestFailed>(message, messageTypes, m => OnTestFailed(new TestFailedInfo(m.TestClass.Class.Name, m.TestMethod.Method.Name, m.TestCase.Traits, m.Test.DisplayName, m.TestCollection.DisplayName, m.ExecutionTime, m.Output, m.ExceptionTypes.FirstOrDefault(), m.Messages.FirstOrDefault(), m.StackTraces.FirstOrDefault()))))
if (DispatchMessage<ITestFailed>(message, messageTypes, m => OnTestFailed(new TestFailedInfo(m.TestClass.Class.Name, m.TestMethod.Method.Name, m.TestCase.Traits, m.Test.DisplayName, m.TestCollection.DisplayName, m.ExecutionTime, m.Output, string.Join("\n\n", m.ExceptionTypes), string.Join("\n\n", m.Messages), string.Join("\n\n", m.StackTraces)))))
return !cancelled;
if (OnTestFinished != null)
if (DispatchMessage<ITestFinished>(message, messageTypes, m => OnTestFinished(new TestFinishedInfo(m.TestClass.Class.Name, m.TestMethod.Method.Name, m.TestCase.Traits, m.Test.DisplayName, m.TestCollection.DisplayName, m.ExecutionTime, m.Output))))
@@ -10,6 +10,7 @@ using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
@@ -253,7 +254,12 @@ namespace Xunit.Runner.Wpf.ViewModel
{
if (StartupAssemblies == null)
return;
var assemblies = StartupAssemblies.Select(x => new AssemblyAndConfigFile(x, configFileName: null));
List<AssemblyAndConfigFile> assemblies = new List<AssemblyAndConfigFile>();
foreach(var assembly in StartupAssemblies)
{
if (File.Exists(assembly))
assemblies.Add(new AssemblyAndConfigFile(assembly, configFileName: null));
}
await AddAssemblies(assemblies);
//await AddAssemblies(ParseCommandLine(Environment.GetCommandLineArgs().Skip(1)));
}
@@ -499,7 +505,7 @@ namespace Xunit.Runner.Wpf.ViewModel
var i = 0;
while (i < this.allTestCases.Count)
{
if (string.Compare(this.allTestCases[i].AssemblyFileName, assemblyPath, StringComparison.OrdinalIgnoreCase) == 0)
if (string.Compare(this.allTestCases[i].AssemblyPath, assemblyPath, StringComparison.OrdinalIgnoreCase) == 0)
{
this.allTestCaseUniqueIDs.Remove(this.allTestCases[i].UniqueID);
this.allTestCases.RemoveAt(i);
@@ -12,9 +12,9 @@ namespace Xunit.Runner.Wpf.ViewModel
private class TraitViewModelComparer : IEqualityComparer<TraitViewModel>, IComparer<TraitViewModel>
{
public int Compare(TraitViewModel x, TraitViewModel y) => StringComparer.Ordinal.Compare(x.Text, y.Text);
public bool Equals(TraitViewModel x, TraitViewModel y) => StringComparer.Ordinal.Equals(x.Text, y.Text);
public int GetHashCode(TraitViewModel obj) => obj.Text.GetHashCode();
public int Compare(TraitViewModel x, TraitViewModel y) => StringComparer.Ordinal.Compare(x.FullText, y.FullText);
public bool Equals(TraitViewModel x, TraitViewModel y) => StringComparer.Ordinal.Equals(x.FullText, y.FullText);
public int GetHashCode(TraitViewModel obj) => obj.FullText.GetHashCode();
}
}
}
@@ -6,118 +6,129 @@ using Xunit.Runner.Wpf;
namespace Xunit.Runner.Wpf.ViewModel
{
public partial class TraitViewModel : ViewModelBase
public partial class TraitViewModel : ViewModelBase
{
private readonly TraitViewModel _parent;
private bool? _isChecked;
private bool _isExpanded;
private string _text;
public ObservableCollection<TraitViewModel> Children { get; }
public TraitViewModel(string text)
: this(null, text)
{
private readonly TraitViewModel _parent;
private bool? _isChecked;
private bool _isExpanded;
private string _text;
public ObservableCollection<TraitViewModel> Children { get; }
public TraitViewModel(string text)
: this(null, text)
{
}
private TraitViewModel(TraitViewModel parent, string text)
{
this._parent = parent;
this._isChecked = false;
this._isExpanded = true;
this._text = text;
this.Children = new ObservableCollection<TraitViewModel>();
}
private void SetIsChecked(bool? value, bool updateChildren, bool updateParent)
{
if (value == this._isChecked)
{
return;
}
this._isChecked = value;
if (updateChildren && value != null)
{
foreach (var child in this.Children)
{
child.SetIsChecked(value, updateChildren: true, updateParent: false);
}
}
if (updateParent && _parent != null)
{
_parent.VerifyCheckState();
}
this.RaisePropertyChanged(nameof(IsChecked));
}
private void VerifyCheckState()
{
bool? state = null;
var isFirst = true;
foreach (var child in this.Children)
{
if (isFirst)
{
state = child.IsChecked;
isFirst = false;
}
else if (state != child.IsChecked)
{
state = null;
break;
}
}
this.SetIsChecked(state, updateChildren: false, updateParent: true);
}
public void AddValues(IEnumerable<string> values)
{
foreach (var value in values)
{
var index = this.Children.BinarySearch(value, StringComparer.Ordinal.Compare, v => v.Text);
if (index < 0)
{
this.Children.Insert(~index, new TraitViewModel(this, value));
}
}
}
public TraitViewModel GetOrAdd(string text)
{
var index = this.Children.BinarySearch(text, StringComparer.Ordinal, vm => vm.Text);
if (index < 0)
{
var viewModel = new TraitViewModel(this, text);
this.Children.Insert(~index, viewModel);
return viewModel;
}
return this.Children[index];
}
public bool? IsChecked
{
get { return _isChecked; }
set { SetIsChecked(value, updateChildren: true, updateParent: true); }
}
public bool IsExpanded
{
get { return _isExpanded; }
set { Set(ref _isExpanded, value); }
}
public string Text
{
get { return _text; }
set { Set(ref _text, value); }
}
}
private TraitViewModel(TraitViewModel parent, string text)
{
this._parent = parent;
this._isChecked = false;
this._isExpanded = true;
this._text = text;
this.Children = new ObservableCollection<TraitViewModel>();
}
private void SetIsChecked(bool? value, bool updateChildren, bool updateParent)
{
if (value == this._isChecked)
{
return;
}
this._isChecked = value;
if (updateChildren && value != null)
{
foreach (var child in this.Children)
{
child.SetIsChecked(value, updateChildren: true, updateParent: false);
}
}
if (updateParent && _parent != null)
{
_parent.VerifyCheckState();
}
this.RaisePropertyChanged(nameof(IsChecked));
}
private void VerifyCheckState()
{
bool? state = null;
var isFirst = true;
foreach (var child in this.Children)
{
if (isFirst)
{
state = child.IsChecked;
isFirst = false;
}
else if (state != child.IsChecked)
{
state = null;
break;
}
}
this.SetIsChecked(state, updateChildren: false, updateParent: true);
}
public void AddValues(IEnumerable<string> values)
{
foreach (var value in values)
{
var index = this.Children.BinarySearch(value, StringComparer.Ordinal.Compare, v => v.Text);
if (index < 0)
{
this.Children.Insert(~index, new TraitViewModel(this, value));
}
}
}
public TraitViewModel GetOrAdd(string text)
{
var index = this.Children.BinarySearch(text, StringComparer.Ordinal, vm => vm.Text);
if (index < 0)
{
var viewModel = new TraitViewModel(this, text);
this.Children.Insert(~index, viewModel);
return viewModel;
}
return this.Children[index];
}
public bool? IsChecked
{
get { return _isChecked; }
set { SetIsChecked(value, updateChildren: true, updateParent: true); }
}
public bool IsExpanded
{
get { return _isExpanded; }
set { Set(ref _isExpanded, value); }
}
public string Text
{
get { return _text; }
set { Set(ref _text, value); }
}
public string FullText
{
get
{
var fullText = _text;
if (_parent != null)
fullText = _parent.FullText + _text;
return fullText;
}
}
}
}
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
@@ -16,7 +16,9 @@
<PackageIcon></PackageIcon>
<PackageIconUrl>https://avatars2.githubusercontent.com/u/2092016</PackageIconUrl>
<PackageIconUrl>https://avatars2.githubusercontent.com/u/2092016</PackageIconUrl>
<Version>1.0.3</Version>
<Version>1.0.9</Version>
<AssemblyVersion>1.0.9.0</AssemblyVersion>
<FileVersion>1.0.9.0</FileVersion>
</PropertyGroup>
<ItemGroup>