Migrate test runner to build tools

This commit is contained in:
John Lewin 2015-12-17 12:20:41 -08:00
parent 25f5b4e898
commit db1d86a4af
9 changed files with 24 additions and 235 deletions

13
Tests/MatterControl.nunit Normal file
View file

@ -0,0 +1,13 @@
<NUnitProject>
<Settings activeconfig="Debug" processModel="Multiple" domainUsage="Multiple" />
<Config name="Debug" binpathtype="Auto" runtimeFramework="v4.0.21006">
<assembly path="..\Submodules\agg-sharp\Tests\Agg.Tests\bin\Debug\Agg.Tests.dll" />
<assembly path="MatterControl.Tests\bin\Debug\MatterControl.Tests.dll" />
<assembly path="..\Submodules\MatterSlice\Tests\MatterSlice.Tests\bin\Debug\MatterSlice.Tests.dll" />
</Config>
<Config name="Release" binpathtype="Auto" runtimeFramework="v4.0.21006">
<assembly path="MatterControl.Tests\bin\Release\MatterControl.Tests.dll" />
<assembly path="..\Submodules\agg-sharp\Tests\Agg.Tests\bin\Release\Agg.Tests.dll" />
<assembly path="..\Submodules\MatterSlice\Tests\MatterSlice.Tests\bin\Release\MatterSlice.Tests.dll" />
</Config>
</NUnitProject>

View file

@ -0,0 +1,11 @@
<NUnitProject>
<Settings activeconfig="Debug" processModel="Multiple" domainUsage="Multiple" />
<Config name="Debug" binpathtype="Auto" runtimeFramework="v4.0.21006">
<assembly path="MatterControl.AutomationTests\bin\Debug\MatterControl.AutomationTests.dll" />
<assembly path="..\..\CloudServicesPlugin\CloudServices.Tests\bin\Debug\CloudServices.Tests.dll" />
</Config>
<Config name="Release" binpathtype="Auto" runtimeFramework="v4.0.21006">
<assembly path="MatterControl.AutomationTests\bin\Release\MatterControl.AutomationTests.dll" />
<assembly path="..\..\CloudServicesPlugin\CloudServices.Tests\bin\Release\CloudServices.Tests.dll" />
</Config>
</NUnitProject>

View file

@ -1,13 +0,0 @@
<NUnitProject>
<Settings activeconfig="Debug" processModel="Multiple" domainUsage="Multiple" />
<Config name="Debug" binpathtype="Auto" runtimeFramework="v4.0.21006">
<assembly path="..\..\Submodules\agg-sharp\Tests\Agg.Tests\bin\Debug\Agg.Tests.dll" />
<assembly path="..\MatterControl.Tests\bin\Debug\MatterControl.Tests.dll" />
<assembly path="..\..\Submodules\MatterSlice\Tests\MatterSlice.Tests\bin\Debug\MatterSlice.Tests.dll" />
</Config>
<Config name="Release" binpathtype="Auto" runtimeFramework="v4.0.21006">
<assembly path="..\MatterControl.Tests\bin\Release\MatterControl.Tests.dll" />
<assembly path="..\..\Submodules\agg-sharp\Tests\Agg.Tests\bin\Release\Agg.Tests.dll" />
<assembly path="..\..\Submodules\MatterSlice\Tests\MatterSlice.Tests\bin\Release\MatterSlice.Tests.dll" />
</Config>
</NUnitProject>

View file

@ -1,11 +0,0 @@
<NUnitProject>
<Settings activeconfig="Debug" processModel="Multiple" domainUsage="Multiple" />
<Config name="Debug" binpathtype="Auto" runtimeFramework="v4.0.21006">
<assembly path="..\MatterControl.AutomationTests\bin\Debug\MatterControl.AutomationTests.dll" />
<assembly path="..\..\..\CloudServicesPlugin\CloudServices.Tests\bin\Debug\CloudServices.Tests.dll" />
</Config>
<Config name="Release" binpathtype="Auto" runtimeFramework="v4.0.21006">
<assembly path="..\MatterControl.AutomationTests\bin\Release\MatterControl.AutomationTests.dll" />
<assembly path="..\..\..\CloudServicesPlugin\CloudServices.Tests\bin\Release\CloudServices.Tests.dll" />
</Config>
</NUnitProject>

View file

@ -1,69 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
namespace TestRunner
{
public class NunitConsoleRunner
{
// Currently just running from the bin folder
private const string nunitPath = "NUnit-2.6.4";
private Uri siteBaseUri = new Uri("http://matterdata.azurewebsites.net/");
public void RunTests(string projectFilePath, string resultsFilePath)
{
if (File.Exists(resultsFilePath))
{
File.Delete(resultsFilePath);
}
string binPath = !Directory.Exists(nunitPath) ? null : Path.Combine(nunitPath, "bin\\nunit-console-x86.exe");
// Run the unit tests
if (!string.IsNullOrWhiteSpace(binPath) && File.Exists(binPath))
{
Process process = new Process();
process.StartInfo.Arguments = string.Format(
"{0} /xml:{1} /noshadow:true /config:Release", // /include:Agg.UI" // /include:MatterControl.UI2;Leveling"
projectFilePath,
resultsFilePath);
process.StartInfo.FileName = binPath;
process.StartInfo.UseShellExecute = true;
process.Start();
process.WaitForExit();
}
}
public Uri RunAndReport(string projectFilePath, string resultsFilePath)
{
RunTests(projectFilePath, resultsFilePath);
Debugger.Launch();
// Post the results
if (!File.Exists(resultsFilePath))
{
return null;
}
else
{
var uri = new Uri(siteBaseUri, "testresults/create/");
// Post the file to the server
var client = new WebClient();
var bytes = client.UploadFile(uri, resultsFilePath);
string reportID = UTF8Encoding.UTF8.GetString(bytes);
// Launch the results
return new Uri(siteBaseUri, "testresults/details/" + reportID);
}
}
}
}

View file

@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Net;
namespace TestRunner
{
class Program
{
static void Main(string[] args)
{
Uri siteBaseUri = new Uri("http://matterdata.azurewebsites.net/");
var consoleRunner = new NunitConsoleRunner();
var resultsUrl = consoleRunner.RunAndReport(
Path.GetFullPath("../../../MatterControl.nunit"),
Path.GetFullPath("results.xml"));
if(resultsUrl != null)
{
// Launch the results
Process.Start(resultsUrl.AbsoluteUri);
}
}
}
}

View file

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TestRunner")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestRunner")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("053add9e-15c5-4ca2-8669-88889e28ef32")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{33677C3F-145C-476B-A882-2A44179CDECB}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TestRunner</RootNamespace>
<AssemblyName>TestRunner</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="NunitConsoleRunner.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRunner", "TestRunner.csproj", "{33677C3F-145C-476B-A882-2A44179CDECB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{33677C3F-145C-476B-A882-2A44179CDECB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33677C3F-145C-476B-A882-2A44179CDECB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33677C3F-145C-476B-A882-2A44179CDECB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33677C3F-145C-476B-A882-2A44179CDECB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal