Skip to content

Commit

Permalink
Merge pull request #361 from nunit/release-3.8.0
Browse files Browse the repository at this point in the history
Release 3.8.0
  • Loading branch information
OsirisTerje committed Jul 19, 2017
2 parents 4a3cb0b + f3f9d21 commit add074d
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 51 deletions.
Binary file modified NUnit3TestAdapter.sln
Binary file not shown.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ The NUnit 3 Test Adapter is Open Source software released under the [MIT license
## Developing

You need Visual Studio 2017 for building the adapter
You will get some failing tests in VS, that is intended. Use command line (Cake build):

You will get some failing tests (6) in VS, that is intended.

Use command line (Cake build):

`build -t test`

to get it right.
to get the right results, or exclude the tests from mock-assembly.

For more details see https://github.com/nunit/docs/wiki/Packaging-the-V3-Adapter
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var configuration = Argument("configuration", "Debug");
//////////////////////////////////////////////////////////////////////

var version = "3.8.0";
var modifier = "-alpha1";
var modifier = "";

var dbgSuffix = configuration == "Debug" ? "-dbg" : "";
var packageVersion = version + modifier + dbgSuffix;
Expand Down
2 changes: 1 addition & 1 deletion demo/NUnit3CoreTestDemo/NUnit3CoreTestDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="NUnit" Version="3.6.1" />
<PackageReference Include="NUnit" Version="3.7.1" />
</ItemGroup>

</Project>
11 changes: 9 additions & 2 deletions demo/NUnitTestDemo/NUnit3TestDemo.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit3TestAdapter.3.8.0-rc1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.3.8.0-rc1\build\net35\NUnit3TestAdapter.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down Expand Up @@ -38,8 +39,8 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
<Reference Include="nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
Expand Down Expand Up @@ -73,6 +74,12 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.3.8.0-rc1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.3.8.0-rc1\build\net35\NUnit3TestAdapter.props'))" />
</Target>
<!-- 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">
Expand Down
3 changes: 2 additions & 1 deletion demo/NUnitTestDemo/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="3.6.1" targetFramework="net45" />
<package id="NUnit" version="3.7.1" targetFramework="net45" />
<package id="NUnit3TestAdapter" version="3.8.0-rc1" targetFramework="net45" />
</packages>
16 changes: 10 additions & 6 deletions src/NUnit3TestAdapterInstall/NUnit3TestAdapterInstall.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Microsoft.VSSDK.BuildTools.15.0.26201\build\Microsoft.VSSDK.BuildTools.props" Condition="Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.0.26201\build\Microsoft.VSSDK.BuildTools.props')" />
<Import Project="..\..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props" Condition="Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand All @@ -24,7 +26,7 @@
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
<DeployExtension>False</DeployExtension>
<IsProductComponent>true</IsProductComponent>
<IsProductComponent>false</IsProductComponent>
<VsixInputFileLocation>..\NUnitTestAdapter\bin\$(Configuration)\net35\</VsixInputFileLocation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down Expand Up @@ -61,7 +63,9 @@
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
Expand All @@ -82,10 +86,10 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.0.26201\build\Microsoft.VSSDK.BuildTools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VSSDK.BuildTools.15.0.26201\build\Microsoft.VSSDK.BuildTools.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.0.26201\build\Microsoft.VSSDK.BuildTools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VSSDK.BuildTools.15.0.26201\build\Microsoft.VSSDK.BuildTools.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.targets'))" />
</Target>
<Import Project="..\..\packages\Microsoft.VSSDK.BuildTools.15.0.26201\build\Microsoft.VSSDK.BuildTools.targets" Condition="Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.0.26201\build\Microsoft.VSSDK.BuildTools.targets')" />
<Import Project="..\..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.targets" Condition="Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.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">
Expand Down
Binary file modified src/NUnit3TestAdapterInstall/license.rtf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/NUnit3TestAdapterInstall/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.VSSDK.BuildTools" version="15.0.26201" targetFramework="net45" developmentDependency="true" />
<package id="Microsoft.VSSDK.BuildTools" version="15.1.192" targetFramework="net45" developmentDependency="true" />
</packages>
48 changes: 26 additions & 22 deletions src/NUnit3TestAdapterInstall/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="NUnit.NUnit3TestAdapter" Version="3.7.0.0" Language="en-US" Publisher="Charlie Poole" />
<DisplayName>NUnit 3 Test Adapter</DisplayName>
<Description xml:space="preserve">NUnit 3 adapter for running tests in Visual Studio. Works with NUnit 3.x, use the NUnit 2 adapter for 2.x tests.</Description>
<MoreInfo>https://github.com/nunit/docs/wiki/Visual-Studio-Test-Adapter</MoreInfo>
<License>license.rtf</License>
<Icon>nunit_90.png</Icon>
<PreviewImage>preview.png</PreviewImage>
<Tags>test, Testing, adapter, NUNit, TDD, NUnit3</Tags>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[11.0,16.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[11.0,16.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[11.0,16.0)"/>
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
</Dependencies>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.25904.2,16.0)" DisplayName="Visual Studio core editor" />
<Prerequisite Id="Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites" Version="[15.0.25904.2,16.0)" DisplayName=".NET desktop development tools" />
</Prerequisites>
<Metadata>
<Identity Id="NUnit.NUnit3TestAdapter" Version="3.8.0.0" Language="en-US" Publisher="Charlie Poole, Terje Sandstrom" />
<DisplayName>NUnit 3 Test Adapter</DisplayName>
<Description xml:space="preserve">NUnit 3 adapter for running tests in Visual Studio. Works with NUnit 3.x.
For running NUnit 2 tests, use the NUnit 2 adapter.</Description>
<MoreInfo>https://github.com/nunit/docs/wiki/Visual-Studio-Test-Adapter</MoreInfo>
<License>license.rtf</License>
<Icon>nunit_90.png</Icon>
<PreviewImage>preview.png</PreviewImage>
<Tags>test, Testing, adapter, NUnit, TDD, NUnit3, UnitTesting</Tags>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[11.0,16.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[11.0,16.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[11.0,16.0)"/>
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
</Dependencies>
<Assets>
<Asset Type="UnitTestExtension" d:Source="File" Path="NUnit3.TestAdapter.dll" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.25904.2,16.0)" DisplayName="Visual Studio core editor" />
<Prerequisite Id="Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites" Version="[15.0.25904.2,16.0)" DisplayName=".NET desktop development tools" />
</Prerequisites>
</PackageManifest>
2 changes: 1 addition & 1 deletion src/NUnitTestAdapter/AdapterSettings.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ***********************************************************************
// Copyright (c) 2014 Charlie Poole, Terje Sandstrom
// Copyright (c) 2014-2017 Charlie Poole, Terje Sandstrom
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
Expand Down
12 changes: 6 additions & 6 deletions src/NUnitTestAdapter/NUnit.TestAdapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@

<ItemGroup Condition="'$(TargetFramework)' == 'net35'">
<PackageReference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel" Version="0.0.3" PrivateAssets="All" />
<PackageReference Include="Mono.Cecil" Version="0.9.6.1" />
<PackageReference Include="nunit.engine" Version="3.6.1" PrivateAssets="All" />
<PackageReference Include="Mono.Cecil" Version="0.9.6.4" />
<PackageReference Include="nunit.engine" Version="3.7.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.0'">
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="1.1.0" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="1.1.2" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="15.0.0" PrivateAssets="All" />
<PackageReference Include="Mono.Cecil" Version="0.10.0-beta4" />
<PackageReference Include="nunit.engine.netstandard" Version="3.7.0-alpha1" />
<PackageReference Include="Mono.Cecil" Version="0.10.0-beta6" />
<PackageReference Include="nunit.engine.netstandard" Version="3.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/NUnitTestAdapter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("NUnit 3 Test Adapter for Visual Studio")]
[assembly: AssemblyDescription("A package including the NUnit 3 TestAdapter for Visual Studio 2012 onwards. With this package you don't need to install the VSIX adapter package, and you don't need to upload the adapter to your TFS server.\r\n \r\nNote that this package ONLY contains the adapter, not the NUnit framework. You must also get the framework. You only need one such package for a solution. \r\n\r\nThe package works with Visual Studio 2012 and newer.\r\n\r\nNote that this package ONLY contains the adapter, not the NUnit framework. You must also get the framework. You only need one such package for a solution.\r\n\r\nThe package works with Visual Studio 2012 and newer.")]
[assembly: AssemblyDescription("A package including the NUnit 3 TestAdapter for Visual Studio 2012 onwards. With this package you don't need to install the VSIX adapter package, and you don't need to upload the adapter to your TFS server.\r\n \r\nNote that this package ONLY contains the adapter, not the NUnit framework. You must also get the framework. You only need one such package for a solution. \r\n\r\nThe package works with Visual Studio 2012 and newer.\r\n")]
[assembly: AssemblyCompany("NUnit Project")]
[assembly: AssemblyProduct("NUnit3TestAdapter")]
[assembly: AssemblyCopyright("Copyright © 2011-2017 Charlie Poole, 2014-2017 Terje Sandstrom")]
Expand Down
3 changes: 2 additions & 1 deletion src/NUnitTestAdapterTests/NUnit.TestAdapter.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

<ItemGroup>
<PackageReference Include="NUnit" Version="3.7.1" />
<PackageReference Include="NUnitLite" Version="3.7.1" />
<PackageReference Include="nunit3testadapter" Version="3.7.0" />
<PackageReference Include="NUnitLite" Version="3.7.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
Expand Down
56 changes: 50 additions & 6 deletions src/NUnitTestAdapterTests/ProjectTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using NUnit.Framework;

namespace NUnit.VisualStudio.TestAdapter.Tests
Expand All @@ -19,7 +16,7 @@ public void ThatTheReferenceToMicrosoftTestObjectModelPointsToVS2012Version()
var dir = TestContext.CurrentContext.TestDirectory;
var assembly = Assembly.LoadFrom(dir + "/NUnit3.TestAdapter.dll");
var refNames = assembly.GetReferencedAssemblies().Where(ass => ass.Name == "Microsoft.VisualStudio.TestPlatform.ObjectModel").ToList();
Assert.IsTrue(refNames != null && refNames.Count() == 1, "No reference to Microsoft.VisualStudio.TestPlatform.ObjectModel found");
Assert.IsTrue(refNames != null && refNames.Count == 1, "No reference to Microsoft.VisualStudio.TestPlatform.ObjectModel found");
Assert.IsTrue(refNames[0].Version.Major == 11, "Microsoft.VisualStudio.TestPlatform.ObjectModel must point to the 2012 version (11)");
}
#endif
Expand All @@ -31,12 +28,59 @@ public void ThatTheTestAdapterEndsWithTestAdapterDll()
Assert.That(adapter, Does.EndWith(".TestAdapter.dll"), $"Ensure the Testadapter {Path.GetFileName(adapter)} ends with '.TestAdapter.dll'");
}


[Test]
public void ThatAdapterInstallProjectHasVsixManifestWithUnitTestExtensionAsset()
{
var location = TestContext.CurrentContext.TestDirectory;
var di = new DirectoryInfo(location).MoveUp(4);
Assert.That(di,Is.Not.Null,"Invalid parent");
var installDir = di.EnumerateDirectories("NUnit3TestAdapterInstall").SingleOrDefault();
Assert.That(installDir,Is.Not.Null,$"Didn't find NUnit3TestAdapterInstall folder at {di.Name}");
var vsixManifestFile = installDir.EnumerateFiles("*.vsixmanifest").SingleOrDefault();
Assert.That(vsixManifestFile,Is.Not.Null,$"Didn't find any vsixmanifestfile at folder {installDir.Name}");
var vsixManifestTxt = File.ReadAllText(vsixManifestFile.FullName);
Assert.That(vsixManifestTxt.Length,Is.GreaterThan(0),"No content in vsixmanifestfile");

var vsixManifest = XDocument.Parse(vsixManifestTxt);
var desc = vsixManifest.Descendants();
var assets = desc.FirstOrDefault(o=>o.Name.LocalName=="Assets");
Assert.That(assets,Is.Not.Null,"Missing Assets");
var assetItems = vsixManifest.Descendants().Where(o => o.Name.LocalName == "Asset").ToList();
Assert.That(assetItems.Count,Is.GreaterThanOrEqualTo(1),"Missing asset items");
var unitTestAsset = assetItems.FirstOrDefault(o => o.Attribute("Type") != null && o.Attribute("Type").Value!=null &&
o.Attribute("Type").Value == "UnitTestExtension");
Assert.That(unitTestAsset,Is.Not.Null, "No asset with type UnitTestExtension found");
var path = unitTestAsset.Attribute("Path");
Assert.That(path,Is.Not.Null,"UnitTestAsset must have path");
Assert.That(path.Value.EndsWith("NUnit3.TestAdapter.dll"), "UnitTestAsset path must contain the NUNit3TestAdapter.dll");

}


[Test]
public void ThatNoMSTestDLLIsCopiedToOutput()
{
var dir = TestContext.CurrentContext.TestDirectory;
var filesNotToExist = Directory.EnumerateFiles(dir, "Microsoft", SearchOption.TopDirectoryOnly);
Assert.IsTrue(!filesNotToExist.Any(),"The reference of NUnitTestAdapter - Microsoft.VisualStudio.TestPlatform.ObjectModel must be set Copy Local to false");
}



}

public static class DirectoryInfoExtensions
{
public static DirectoryInfo MoveUp(this DirectoryInfo di, int noOfLevels)
{
var grandParent = di;
for (int i = 0; i < noOfLevels; i++)
grandParent= grandParent?.Parent;
return grandParent;
}
}



}

0 comments on commit add074d

Please sign in to comment.