Skip to content

Commit

Permalink
Merge pull request #66 from nunit/prepare-for-1-3
Browse files Browse the repository at this point in the history
Prepare for 2.0, merged
  • Loading branch information
OsirisTerje committed Apr 1, 2015
2 parents ac9825d + 2b2a287 commit d88be78
Show file tree
Hide file tree
Showing 25 changed files with 147 additions and 132 deletions.
Binary file modified NUnitTestAdapter.sln
Binary file not shown.
Binary file modified lib/mock-assembly.dll
Binary file not shown.
Binary file modified lib/nunit.core.dll
Binary file not shown.
Binary file modified lib/nunit.core.interfaces.dll
Binary file not shown.
Binary file modified lib/nunit.framework.dll
Binary file not shown.
Binary file modified lib/nunit.util.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions nuget/NUnitVisualStudioTestAdapter.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<projectUrl>http://nunit.org/index.php?p=vsTestAdapter&amp;r=2.6</projectUrl>
<iconUrl>http://nunit.org/nuget/nunit_32x32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A package including the NUnit TestAdapter for Visual Studio 2012/13. 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.
<description>A package including the NUnit TestAdapter for Visual Studio 2012/13/15. 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.
Note that this package ONLY contains the adapter, not the NUnit framework. You must also get the framework, or use the NUnitTestAdapter.WithFramework nuget package.
You only need one such package for a solution.
The package works with Visual Studio 2012 from RTM, and with Update 1 and higher, and with Visual Studio 2013 from RTM, and tested up to Update 2 RC.</description>
<releaseNotes>Updated to NUnit 2.6.3, Misc bug fixes</releaseNotes>
The package works with Visual Studio 2012 from RTM, and all Updates, and with Visual Studio 2013 RTM and all updates, and Visual Studio 2015 tested up to CTP6</description>
<releaseNotes>Updated to NUnit 2.6.4, Support for VS 2015, Misc bug fixes</releaseNotes>
<copyright>NUnit Software</copyright>
<language>en-US</language>
<tags>test visualstudio testadapter</tags>
Expand Down
12 changes: 7 additions & 5 deletions nuget/NUnitVisualStudioTestAdapterAndFramework.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
<metadata>
<id>NUnitTestAdapter.WithFramework</id>
<version>${package.version}</version>
<title>NUnit TestAdapter including NUnit 2.6.3 framework</title>
<title>NUnit TestAdapter including NUnit 2.6.4 framework</title>
<authors>NUnit Software</authors>
<owners>NUnit Software</owners>
<licenseUrl>http://visualstudiogallery.msdn.microsoft.com/site/6ab922d0-21c0-4f06-ab5f-4ecd1fe7175d/eula?licenseType=None</licenseUrl>
<projectUrl>http://nunit.org/index.php?p=vsTestAdapter&amp;r=2.6</projectUrl>
<iconUrl>http://nunit.org/nuget/nunit_32x32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A package including the NUnit test frameworks and the Visual Studio 2012/13 test adapter. 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.
Note that this package also contains the NUnit framework.
The package works with Visual Studio 2012 from RTM, and all Updates, and with Visual Studio 2013 RTM, tested to Update 2 RC.</description>
<releaseNotes>Updated to NUnit 2.6.3, Misc bug fixes</releaseNotes>
<description>
A package including the NUnit test frameworks and the Visual Studio 2012/13 test adapter. 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.
Note that this package also contains the NUnit framework.
The package works with Visual Studio 2012 from RTM, and all Updates, and with Visual Studio 2013 RTM and all updates, and Visual Studio 2015 tested up to CTP6
</description>
<releaseNotes>Updated to NUnit 2.6.4, Support for VS 2015, Misc bug fixes</releaseNotes>
<copyright>NUnit Software</copyright>
<language>en-US</language>
<tags>test visualstudio testadapter</tags>
Expand Down
148 changes: 74 additions & 74 deletions nunit-vs-adapter.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


<!-- Set version number for package -->
<property name="package.version" value="1.2"/>
<property name="package.version" value="2.0.0"/>

<!-- Define package name, including version -->
<property name="package.base.name" value="NUnitVisualStudioTestAdapter"/>
Expand All @@ -33,78 +33,78 @@
<target name="test" description="Test the adapter (NYI)"/>

<target name="package" desciption="Package the adapter"
depends="package-vsix,package-zip,package-nuget-1,package-nuget-2"/>

<target name="package-vsix">
<!-- Copy the vsix package, built by Visual Studio. -->
<property name="source.vsix.file" value="NUnitTestAdapter.vsix"/>
<property name="target.vsix.file" value="${package.name}.vsix"/>
<copy file="${path::combine(install.release.dir, source.vsix.file)}"
tofile="${path::combine(project.package.dir, target.vsix.file)}"/>
</target>

<target name="package-zip">

<!-- Create the working directory -->
<mkdir dir="${package.working.dir}"/>

<!-- Copy binaries to the working directory for zipping. -->
<copy todir="${package.working.dir}">
<fileset basedir="${install.release.dir}">
<include name="NUnit.VisualStudio.TestAdapter.dll"/>
<include name="nunit.util.dll"/>
<include name="nunit.core.dll"/>
<include name="nunit.core.interfaces.dll"/>
</fileset>
</copy>

<!-- Create the zip package -->
<property name="zip.file.name" value="${package.name}.zip"/>
<zip ziplevel="9"
zipfile="${project.package.dir}/${zip.file.name}">
<fileset basedir="${package.working.dir}" prefix="${package.name}">
<include name="**"/>
</fileset>
</zip>

</target>

<target name="package-nuget-1">

<property name="nuget.package.name" value="NUnitVisualStudioTestAdapter"/>
<property name="nuget.internal.id" value="NUnitTestAdapter"/>
<call target="create-nuget-package"/>

</target>

<target name="package-nuget-2">

<property name="nuget.package.name" value="NUnitVisualStudioTestAdapterAndFramework"/>
<property name="nuget.internal.id" value="NUnitTestAdapter.WithFramework"/>
<call target="create-nuget-package"/>

</target>

<target name="create-nuget-package">
<copy file="${project.nuget.dir}/${nuget.package.name}.nuspec"
tofile="${project.package.dir}/${nuget.package.name}-${package.version}.nuspec"
overwrite="true">
<filterchain>
<expandproperties/>
</filterchain>
</copy>

<exec program="NuGet.exe"
workingdir="${project.package.dir}"
commandline="pack ${nuget.package.name}-${package.version}.nuspec" />

<move file="${project.package.dir}/${nuget.internal.id}.${package.version}.nupkg"
tofile="${project.package.dir}/${nuget.package.name}-${package.version}.nupkg"/>

</target>
depends="package-vsix,package-zip,package-nuget-1,package-nuget-2"/>

<target name="package-vsix">
<!-- Copy the vsix package, built by Visual Studio. -->
<property name="source.vsix.file" value="NUnitTestAdapter.vsix"/>
<property name="target.vsix.file" value="${package.name}.vsix"/>
<copy file="${path::combine(install.release.dir, source.vsix.file)}"
tofile="${path::combine(project.package.dir, target.vsix.file)}"/>
</target>

<target name="package-zip">

<!-- Create the working directory -->
<mkdir dir="${package.working.dir}"/>

<!-- Copy binaries to the working directory for zipping. -->
<copy todir="${package.working.dir}">
<fileset basedir="${install.release.dir}">
<include name="NUnit.VisualStudio.TestAdapter.dll"/>
<include name="nunit.util.dll"/>
<include name="nunit.core.dll"/>
<include name="nunit.core.interfaces.dll"/>
</fileset>
</copy>

<!-- Create the zip package -->
<property name="zip.file.name" value="${package.name}.zip"/>
<zip ziplevel="9"
zipfile="${project.package.dir}/${zip.file.name}">
<fileset basedir="${package.working.dir}" prefix="${package.name}">
<include name="**"/>
</fileset>
</zip>

</target>

<target name="package-nuget-1">

<property name="nuget.package.name" value="NUnitVisualStudioTestAdapter"/>
<property name="nuget.internal.id" value="NUnitTestAdapter"/>
<call target="create-nuget-package"/>

</target>

<target name="package-nuget-2">

<property name="nuget.package.name" value="NUnitVisualStudioTestAdapterAndFramework"/>
<property name="nuget.internal.id" value="NUnitTestAdapter.WithFramework"/>
<call target="create-nuget-package"/>

</target>

<target name="create-nuget-package">
<copy file="${project.nuget.dir}/${nuget.package.name}.nuspec"
tofile="${project.package.dir}/${nuget.package.name}-${package.version}.nuspec"
overwrite="true">
<filterchain>
<expandproperties/>
</filterchain>
</copy>

<exec program="NuGet.exe"
workingdir="${project.package.dir}"
commandline="pack ${nuget.package.name}-${package.version}.nuspec" />

<move file="${project.package.dir}/${nuget.internal.id}.${package.version}.nupkg"
tofile="${project.package.dir}/${nuget.package.name}-${package.version}.nupkg"/>

</target>
</project>

16 changes: 8 additions & 8 deletions src/NUnitTestAdapter/AssemblyRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,33 @@ public class AssemblyRunner : IDisposable
private TestFilter nunitFilter;
private readonly List<TestCase> loadedTestCases;
private readonly TestConverter testConverter;
private INUnitTestAdapter NUnitTestAdapter { get; set; }

#region Constructors

// This constructor is called by the others and is used directly for testing
public AssemblyRunner(TestLogger logger, string assemblyName)
public AssemblyRunner(TestLogger logger, string assemblyName, INUnitTestAdapter nunitTestAdapter)
{
this.logger = logger;
this.assemblyName = assemblyName;
testConverter = new TestConverter(logger, assemblyName);
loadedTestCases = new List<TestCase>();
nunitFilter = TestFilter.Empty;
NUnitTestAdapter = nunitTestAdapter;
}

// This constructor is used when the executor is called with a list of test cases
public AssemblyRunner(TestLogger logger, string assemblyName, IEnumerable<TestCase> selectedTestCases)
: this(logger, assemblyName)
public AssemblyRunner(TestLogger logger, string assemblyName, IEnumerable<TestCase> selectedTestCases, INUnitTestAdapter nunitTestAdapter)
: this(logger, assemblyName, nunitTestAdapter)
{
nunitFilter = MakeTestFilter(selectedTestCases);
}

private readonly ITfsTestFilter tfsFilter;

// This constructor is used when the executor is called with a list of assemblies
public AssemblyRunner(TestLogger logger, string assemblyName, ITfsTestFilter tfsFilter)
: this(logger, assemblyName)
public AssemblyRunner(TestLogger logger, string assemblyName, ITfsTestFilter tfsFilter, INUnitTestAdapter nunitTestAdapter)
: this(logger, assemblyName, nunitTestAdapter)
{
this.tfsFilter = tfsFilter;
}
Expand Down Expand Up @@ -155,9 +157,7 @@ public void CancelRun()
// future calls to convert a test case may now use the cache.
private bool TryLoadAssembly()
{
var package = new TestPackage(assemblyName);
package.Settings["ShadowCopyFiles"] = false;
logger.SendDebugMessage("ShadowCopyFiles is set to :" + package.Settings["ShadowCopyFiles"]);
var package = NUnitTestAdapter.CreateTestPackage(assemblyName);
if (!runner.Load(package))
return false;
logger.SendMessage(TestMessageLevel.Informational,string.Format("Loading tests from {0}",package.FullName));
Expand Down
28 changes: 23 additions & 5 deletions src/NUnitTestAdapter/NUnitTestAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,31 @@
using System;
using System.Reflection;
using System.Runtime.Remoting.Channels;
using NUnit.Core;
using NUnit.Util;

namespace NUnit.VisualStudio.TestAdapter
{
public interface INUnitTestAdapter
{
TestPackage CreateTestPackage(string sourceAssembly);
}

/// <summary>
/// NUnitTestAdapter is the common base for the
/// NUnit discoverer and executor classes.
/// </summary>
public abstract class NUnitTestAdapter
public abstract class NUnitTestAdapter : INUnitTestAdapter
{
// Our logger used to display messages
protected TestLogger TestLog;
// The adapter version
private readonly string adapterVersion;

protected bool UseVsKeepEngineRunning { get; private set; }
protected bool ShadowCopy { get; private set; }
public bool ShadowCopy { get; private set; }

protected int Verbosity { get; private set; }
public int Verbosity { get; private set; }


protected bool RegistryFailure { get; set; }
Expand Down Expand Up @@ -67,16 +73,18 @@ protected NUnitTestAdapter()

#region Protected Helper Methods

private const string Name = "NUnit VS Adapter";

protected void Info(string method, string function)
{
var msg = string.Format("NUnit {0} {1} is {2}", adapterVersion, method, function);
var msg = string.Format("{0} {1} {2} is {3}",Name, adapterVersion, method, function);
TestLog.SendInformationalMessage(msg);
}

protected void Debug(string method, string function)
{
#if DEBUG
var msg = string.Format("NUnit {0} {1} is {2}", adapterVersion, method, function);
var msg = string.Format("{0} {1} {2} is {3}", Name, adapterVersion, method, function);
TestLog.SendDebugMessage(msg);
#endif
}
Expand All @@ -87,6 +95,16 @@ protected static void CleanUpRegisteredChannels()
ChannelServices.UnregisterChannel(chan);
}

public TestPackage CreateTestPackage(string sourceAssembly)
{
var package = new TestPackage(sourceAssembly);
package.Settings["ShadowCopyFiles"] = ShadowCopy;
TestLog.SendDebugMessage("ShadowCopyFiles is set to :" + package.Settings["ShadowCopyFiles"]);
return package;
}

#endregion
}


}
7 changes: 5 additions & 2 deletions src/NUnitTestAdapter/NUnitTestDiscoverer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discove
TestLog.SendDebugMessage("Processing " + sourceAssembly);

TestRunner runner = new TestDomain();
TestPackage package = new TestPackage(sourceAssembly);
package.Settings["ShadowCopyFiles"] = ShadowCopy;
var package = CreateTestPackage(sourceAssembly);
TestConverter testConverter = null;
try
{
Expand Down Expand Up @@ -72,6 +71,10 @@ public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discove
// Attempts to load an invalid assembly, or an assembly with missing dependencies
TestLog.LoadingAssemblyFailedWarning(ex.FileName, sourceAssembly);
}
catch (UnsupportedFrameworkException ex)
{
TestLog.UnsupportedFrameworkWarning(sourceAssembly);
}
catch (Exception ex)
{

Expand Down
4 changes: 2 additions & 2 deletions src/NUnitTestAdapter/NUnitTestExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrame
{
sourceAssembly = Path.Combine(Environment.CurrentDirectory, sourceAssembly);
}
using (currentRunner = new AssemblyRunner(TestLog, sourceAssembly, tfsfilter))
using (currentRunner = new AssemblyRunner(TestLog, sourceAssembly, tfsfilter,this))
{
currentRunner.RunAssembly(frameworkHandle);
}
Expand Down Expand Up @@ -113,7 +113,7 @@ public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrame
var assemblyGroups = tests.GroupBy(tc => tc.Source);
foreach (var assemblyGroup in assemblyGroups)
{
using (currentRunner = new AssemblyRunner(TestLog, assemblyGroup.Key, assemblyGroup))
using (currentRunner = new AssemblyRunner(TestLog, assemblyGroup.Key, assemblyGroup,this))
{
currentRunner.RunAssembly(frameworkHandle);
}
Expand Down
6 changes: 3 additions & 3 deletions src/NUnitTestAdapter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("NUnit Software")]
[assembly: AssemblyProduct("NUnit.VisualStudio.TestAdapter")]
[assembly: AssemblyCopyright("Copyright 2011-2014, NUnit Software")]
[assembly: AssemblyCopyright("Copyright 2011-2015, NUnit Software")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(false)]
Expand All @@ -21,5 +21,5 @@
[assembly: ComVisible(false)]

[assembly: Guid("c0aad5e4-b486-49bc-b3e8-31e01be6fefe")]
[assembly: AssemblyVersion("1.2.0.1")]
[assembly: AssemblyFileVersion("1.2.0.1")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
5 changes: 5 additions & 0 deletions src/NUnitTestAdapter/TestLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public void DependentAssemblyNotFoundWarning(string dependentAssembly, string so
SendWarningMessage("Dependent Assembly " + dependentAssembly + " of " + sourceAssembly + " not found. Can be ignored if not a NUnit project.");
}

public void UnsupportedFrameworkWarning(string assembly)
{
SendWarningMessage("Attempt to load assembly with unsupported test framework in "+assembly);
}

public void LoadingAssemblyFailedWarning(string dependentAssembly, string sourceAssembly)
{
SendWarningMessage("Assembly " + dependentAssembly + " loaded through " + sourceAssembly + " failed. Assembly is ignored. Correct deployment of dependencies if this is an error.");
Expand Down
1 change: 0 additions & 1 deletion src/NUnitTestAdapterInstall/NUnitTestAdapterInstall.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="preview.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<None Include="source.extension.vsixmanifest">
Expand Down
Binary file modified src/NUnitTestAdapterInstall/license.rtf
Binary file not shown.
Binary file modified src/NUnitTestAdapterInstall/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d88be78

Please sign in to comment.