summaryrefslogtreecommitdiff
path: root/tests/tests.targets
blob: 7fd0696602f15ff1fc2ccdd7357e7593903fa9d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <UsingTask AssemblyFile="$(PackagesDir)xunit.runners.2.0.0-beta5-build2785\tools\xunit.runner.msbuild.dll" TaskName="Xunit.Runner.MSBuild.xunit" />
  
  <ItemGroup>
    <_SkipTestAssemblies Include="$(SkipTestAssemblies)" />
  </ItemGroup>

  <PropertyGroup>
      <TestAssemblyDir Condition="'$(TestAssemblyDir)' == ''">$(BaseOutputPathWithConfig)\tests\XunitRunner\</TestAssemblyDir>
      <__TestRunHtmlLog Condition="'$(__TestRunHtmlLog)' == ''">$(__LogsDir)\TestRun.html</__TestRunHtmlLog>
      <__TestRunXmlLog Condition="'$(__TestRunXmlLog)' == ''">$(__LogsDir)\TestRun.xml</__TestRunXmlLog>
  </PropertyGroup>
  <Target Name="FindTestDirectories">
    <ItemGroup>
      <AllTestAssemblies Include="$(TestAssemblyDir)*.XUnitWrapper.dll" />
      <TestAssemblies Include="@(AllTestAssemblies)" Exclude="@(_SkipTestAssemblies -> '$(TestAssemblyDir)%(Identity).XUnitWrapper.dll')" />
    </ItemGroup>
    
    <Error  Text=" The Wrappers must be compiled and placed at $(TestAssemblyDir) before they can be run, Do a clean Test Run"
            Condition="'@(AllTestAssemblies)' == ''" />
    
    <Message Text= "AllTestAssemblies= @(AllTestAssemblies)"/>
    <Message Text= "TestAssemblies= @(TestAssemblies)"/>
    <Message Text= "_SkipTestAssemblies= @(_SkipTestAssemblies -> '$(TestAssemblyDir)%(Identity).XUnitWrapper.dll')"/>
  </Target>
   <PropertyGroup>
      <ThisTestWorkingDir>$(TestAssemblyDir)\</ThisTestWorkingDir>
  </PropertyGroup>

  <UsingTask
    AssemblyFile="$(SourceDir)\packages\xunit.abstractions.$(XunitVersionCompiled)\lib\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.runner.msbuild.dll"
    TaskName="Xunit.Runner.MSBuild.xunit" />

   <Target Name="RunTests"
          DependsOnTargets="FindTestDirectories"
          Inputs="@(TestAssemblies)"
          Outputs="$(ThisTestWorkingDir)\*.*"
          Condition="'$(SkipTests)' != 'True'">


    <PropertyGroup>
      <ExcludeTraits Condition="'$(ExcludeTraits)'==''">category=outerloop;category=failing</ExcludeTraits>
    </PropertyGroup>
    <ItemGroup>
      <IncludeTraitsItems Include="$(IncludeTraits)" />
      <ExcludeTraitsItems Include="$(ExcludeTraits)" />
    </ItemGroup>

    <xunit Assemblies="@(TestAssemblies)"
      WorkingFolder="$(ThisTestWorkingDir)"
      ParallelizeAssemblies="True"
      ParallelizeTestCollections="True"
      Html="$(__TestRunHtmlLog)"
      Xml="$(__TestRunXmlLog)"
      IncludeTraits="@(IncludeTraitsItems)"
      ExcludeTraits="@(ExcludeTraitsItems)" /> 

  </Target>

</Project>