Skip to content

Commit 890f4df

Browse files
committed
Improve speed of VS test runs
- related to aspnet#11 (4 of 4 additions) - need xUnit.net AppDomain support in console runs but not in VS runs - setting in `WebStack.xunit.targets` overrides `xunit.runner.json` default - somewhat avoids issues such as xunit/xunit#353 and xunit/xunit#947 - pre-enumerating `[Theory]`s also slows down test discovery and execution - remains a good idea to leave the test execution engine running
1 parent 0c3cbd2 commit 890f4df

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

test/Microsoft.TestCommon/Microsoft.TestCommon.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@
107107
</ItemGroup>
108108
<ItemGroup>
109109
<None Include="packages.config" />
110+
<None Include="xunit.runner.json">
111+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
112+
</None>
110113
</ItemGroup>
111114
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
115+
<ProjectExtensions>
116+
<VisualStudio>
117+
<UserProperties xunit_1runner_1json__JSONSchema="https://xunit.github.io/schema/v2.1-rc1/xunit.runner.schema.json" />
118+
</VisualStudio>
119+
</ProjectExtensions>
112120
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"appDomain": "denied",
3+
"preEnumerateTheories": false
4+
}

tools/WebStack.xunit.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
<UsingTask TaskName="Xunit.Runner.MSBuild.xunit" AssemblyFile="@(XunitMsBuildRunner)"/>
1010

1111
<Target Name="Xunit">
12-
<xunit Assemblies="$(TestAssembly)" XmlV1="$(XmlPath)"/>
12+
<!-- Override AppDomains default (set in xunit.runner.json). Need them with this runner. -->
13+
<xunit AppDomains="true" Assemblies="$(TestAssembly)" XmlV1="$(XmlPath)"/>
1314
<!-- Replace potentially illegal escaped characters (if they get through validations done during Save) -->
1415
<RegexReplace
1516
Files="$(XmlPath)"

0 commit comments

Comments
 (0)