Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert all tests to use xunit #63

Merged
merged 1 commit into from
Jun 12, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
[Dd]ependencies.hiv
Dependencies.hiv
TestResults
43 changes: 0 additions & 43 deletions test/BVTs.testlist

This file was deleted.

1 change: 0 additions & 1 deletion test/RunTimeBVTs.testlist

This file was deleted.

1 change: 0 additions & 1 deletion test/burnbvt.bat

This file was deleted.

Binary file not shown.
Binary file modified test/data/SharedData/Baselines/MSIs/basicproduct.msi
Binary file not shown.
4 changes: 4 additions & 0 deletions test/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit.runners" version="1.9.2" targetFramework="net40" />
</packages>
30 changes: 15 additions & 15 deletions test/src/IntegrationTests/Burn/BasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class BasicTests : BurnTestBase
private BundleBuilder bundleA;

[NamedFact]
[Trait("RuntimeTest", "true")]
[RuntimeTest]
public void Burn_InstallUninstall()
{
// Build the packages.
Expand Down Expand Up @@ -62,11 +62,11 @@ public void Burn_InstallUninstall()
Assert.False(MsiVerifier.IsPackageInstalled(packageA));
Assert.False(MsiVerifier.IsPackageInstalled(packageB));

this.Completed();
this.Complete();
}

[NamedFact]
[Trait("RuntimeTest", "true")]
[RuntimeTest]
public void Burn_InstallLockUninstallInstallUninstall()
{
// Build.
Expand Down Expand Up @@ -106,11 +106,11 @@ public void Burn_InstallLockUninstallInstallUninstall()
Assert.False(this.TryGetBundleRegistration("5802E2D0-AC39-4486-86FF-D4B7AD012EB5", out registration));
Assert.Null(registration);

this.Completed();
this.Complete();
}

[NamedFact]
[Trait("RuntimeTest", "true")]
[RuntimeTest]
public void Burn_MajorUpgrade()
{
string v2Version = "2.0.0.0";
Expand Down Expand Up @@ -142,11 +142,11 @@ public void Burn_MajorUpgrade()
Assert.False(MsiVerifier.IsPackageInstalled(packageAv1));
Assert.False(MsiVerifier.IsPackageInstalled(packageAv2));

this.Completed();
this.Complete();
}

[NamedFact]
[Trait("RuntimeTest", "true")]
[RuntimeTest]
public void Burn_MajorUpgradeUsingModify()
{
string v2Version = "2.0.0.0";
Expand Down Expand Up @@ -176,11 +176,11 @@ public void Burn_MajorUpgradeUsingModify()
Assert.False(MsiVerifier.IsPackageInstalled(packageAv1));
//Assert.False(MsiVerifier.IsPackageInstalled(packageAv2));

this.Completed();
this.Complete();
}

//[NamedFact(Skip="This test is not supported yet.")]
//[Trait("RuntimeTest", "true")]
//[RuntimeTest]
//public void Burn_MajorUpgradeSameVersion()
//{
// // Build the packages.
Expand Down Expand Up @@ -214,7 +214,7 @@ public void Burn_MajorUpgradeUsingModify()
//}

[NamedFact]
[Trait("RuntimeTest", "true")]
[RuntimeTest]
public void Burn_SharedMinorUpgrade()
{
string productCode = Guid.NewGuid().ToString("B").ToUpperInvariant();
Expand Down Expand Up @@ -270,11 +270,11 @@ public void Burn_SharedMinorUpgrade()
installerA.Uninstall();
Assert.False(MsiVerifier.IsProductInstalled(productCode));

this.Completed();
this.Complete();
}

[NamedFact]
[Trait("RuntimeTest", "true")]
[RuntimeTest]
public void Burn_MajorUpgradeRemovesPackageFixedByRepair()
{
string v2Version = "2.0.0.0";
Expand Down Expand Up @@ -317,11 +317,11 @@ public void Burn_MajorUpgradeRemovesPackageFixedByRepair()
Assert.False(MsiVerifier.IsPackageInstalled(packageAv1));
Assert.False(MsiVerifier.IsPackageInstalled(packageAv2));

this.Completed();
this.Complete();
}

[NamedFact]
[Trait("RuntimeTest", "true")]
[RuntimeTest]
public void Burn_ValidateMultipleSourcePaths()
{
// Build the package.
Expand Down Expand Up @@ -354,7 +354,7 @@ public void Burn_ValidateMultipleSourcePaths()
installerA.Uninstall();
Assert.False(MsiVerifier.IsPackageInstalled(packageA));

this.Completed();
this.Complete();
}

private PackageBuilder GetPackageA()
Expand Down
21 changes: 15 additions & 6 deletions test/src/IntegrationTests/Burn/BurnIntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@
<Compile Include="RestartTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="xunit">
<HintPath>..\..\..\..\packages\xunit.1.9.1\lib\net20\xunit.dll</HintPath>
<Reference Include="xunit, Version=1.9.2.1705, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(XunitPath)\xunit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand All @@ -43,18 +45,25 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="BasicTests\A.wxs">
<Content Include="..\..\..\data\Integration\BurnIntegrationTests\BasicTests\A.wxs">
<Link>BasicTests\A.wxs</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="BasicTests\B.wxs">
<Content Include="..\..\..\data\Integration\BurnIntegrationTests\BasicTests\B.wxs">
<Link>BasicTests\B.wxs</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="BasicTests\BundleA.wxs">
<Content Include="..\..\..\data\Integration\BurnIntegrationTests\BasicTests\BundleA.wxs">
<Link>BasicTests\BundleA.wxs</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="BasicTests\BundleB.wxs">
<Content Include="..\..\..\data\Integration\BurnIntegrationTests\BasicTests\BundleB.wxs">
<Link>BasicTests\BundleB.wxs</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.targets" />
</Project>
63 changes: 60 additions & 3 deletions test/src/IntegrationTests/Burn/BurnTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@

namespace WixTest.BurnIntegrationTests
{
using System;
using System.Linq;
using System.IO;
using Microsoft.Tools.WindowsInstallerXml.Bootstrapper;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

/// <summary>
/// Base classs for all Burn tests.
Expand All @@ -26,6 +27,62 @@ public class BurnTestBase : WixTestBase

public static string TestValueVerifyArguments = "VerifyArguments";

/// <summary>
/// Creates an instance of a <see cref="PackageBuilder"/>.
/// </summary>
/// <param name="name">The name of the package to create.</param>
/// <param name="bindPaths">Additional bind paths for building the package.</param>
/// <param name="preprocessorVariables">Preprocessor variables for building the package.</param>
/// <param name="extensions">Extensions for building the package.</param>
/// <returns>A new <see cref="PackageBuilder"/> initialized with the given data.</returns>
protected PackageBuilder CreatePackage(string name, Dictionary<string, string> bindPaths = null, Dictionary<string, string> preprocessorVariables = null, string[] extensions = null)
{
string testDataDirectory = Path.Combine(this.TestContext.TestDataDirectory, @"Integration\BurnIntegrationTests\BasicTests");
PackageBuilder builder = new PackageBuilder(this.TestContext.TestName, name, testDataDirectory, this.TestArtifacts);

if (null != bindPaths)
{
builder.BindPaths = bindPaths;
}

if (null != preprocessorVariables)
{
builder.PreprocessorVariables = preprocessorVariables;
}

builder.Extensions = extensions ?? WixTestBase.Extensions;

return builder.Build();
}

/// <summary>
/// Creates an instance of a <see cref="BundleBuilder"/>.
/// </summary>
/// <param name="name">The name of the bundle to create.</param>
/// <param name="bindPaths">Additional bind paths for building the bundle.</param>
/// <param name="preprocessorVariables">Preprocessor variables for building the bundle.</param>
/// <param name="extensions">Extensions for building the bundle.</param>
/// <returns>A new <see cref="BundleBuilder"/> initialized with the given data.</returns>
protected BundleBuilder CreateBundle(string name, Dictionary<string, string> bindPaths = null, Dictionary<string, string> preprocessorVariables = null, string[] extensions = null)
{
string testDataDirectory = Path.Combine(this.TestContext.TestDataDirectory, @"Integration\BurnIntegrationTests\BasicTests");
BundleBuilder builder = new BundleBuilder(this.TestContext.TestName, name, testDataDirectory, this.TestArtifacts);

if (null != bindPaths)
{
builder.BindPaths = bindPaths;
}

if (null != preprocessorVariables)
{
builder.PreprocessorVariables = preprocessorVariables;
}

builder.Extensions = extensions ?? WixTestBase.Extensions;

return builder.Build();
}

/// <summary>
/// Tries to load the bundle registration using the upgrade code.
/// </summary>
Expand Down
6 changes: 2 additions & 4 deletions test/src/IntegrationTests/Burn/RestartTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ public class RestartTests : BurnTestBase
private BundleBuilder bundleA;

[NamedFact(Skip="Disabling this test since it does not consistently lock the file in a way that the Windows Installer sees FilesInUse.")]
[Trait("RuntimeTest", "true")]
[RuntimeTest]
public void Burn_RetryThenCancel()
{
this.Initialize(dataFolder: "BasicTests");

this.SetPackageRetryExecuteFilesInUse("PackageA", 1);

string bundleAPath = this.GetBundleA().Output;
Expand All @@ -40,7 +38,7 @@ public void Burn_RetryThenCancel()
installA.Install(expectedExitCode:(int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT);
}

this.Completed();
this.Complete();
}

private PackageBuilder GetPackageA()
Expand Down
11 changes: 11 additions & 0 deletions test/src/IntegrationTests/Burn/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="xunit" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.9.1.1600" newVersion="1.9.1.1600" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
2 changes: 1 addition & 1 deletion test/src/IntegrationTests/Burn/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="xunit" version="1.9.1" targetFramework="net40" />
<package id="xunit" version="1.9.2" targetFramework="net40" />
</packages>
Loading