added parallel test execution support for ncrunch.

pull/4/head
kay.one 12 years ago
parent 130be58f8c
commit ff09773a3b

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using Autofac;
using FluentAssertions;
using NCrunch.Framework;
using NUnit.Framework;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Providers;
@ -15,6 +16,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test
{
[TestFixture]
[ExclusivelyUses("REAL_LOG_FILE")]
class CentralDispatchFixture : CoreTest
{
readonly IList<string> indexers = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(IndexerBase))).Select(c => c.ToString()).ToList();
@ -120,7 +122,7 @@ namespace NzbDrone.Core.Test
[Test]
public void quality_profile_initialized()
{
kernel.Resolve<QualityProvider>().All().Should().HaveCount(4);
kernel.Resolve<QualityProvider>().All().Should().HaveCount(2);
}
[Test]

@ -16,7 +16,12 @@ namespace NzbDrone.Core.Test.Framework
{
internal static class TestDbHelper
{
private const string DB_TEMPLATE_NAME = "_dbtemplate.sdf";
private static readonly string dbTemplateName;
static TestDbHelper()
{
dbTemplateName = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()) + ".sdf";
}
internal static string ConnectionString { get; private set; }
@ -30,7 +35,7 @@ namespace NzbDrone.Core.Test.Framework
fileName = Guid.NewGuid() + ".sdf";
}
File.Copy(DB_TEMPLATE_NAME, fileName);
File.Copy(dbTemplateName, fileName);
ConnectionString = ConnectionFactory.GetConnectionString(fileName);
@ -46,7 +51,7 @@ namespace NzbDrone.Core.Test.Framework
internal static void CreateDataBaseTemplate()
{
Console.WriteLine("Creating an empty PetaPoco database");
var connectionString = ConnectionFactory.GetConnectionString(DB_TEMPLATE_NAME);
var connectionString = ConnectionFactory.GetConnectionString(dbTemplateName);
var database = ConnectionFactory.GetPetaPocoDb(connectionString);
database.Dispose();
}

@ -95,6 +95,10 @@
<Reference Include="Moq, Version=4.0.10827.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
</Reference>
<Reference Include="NCrunch.Framework, Version=1.43.0.23, Culture=neutral, PublicKeyToken=01d101bf6f3e0aea, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\NCrunch.Framework.1.43.0.23\lib\net35\NCrunch.Framework.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>

@ -14,6 +14,7 @@
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
<DefaultTestTimeout>60000</DefaultTestTimeout>
<UseBuildConfiguration></UseBuildConfiguration>
<UseBuildPlatform></UseBuildPlatform>
<ProxyProcessPath></ProxyProcessPath>
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
<IgnoredTests>
@ -26,5 +27,9 @@
<NamedTestSelector>
<TestName>NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests.ImportFileFixture.import_unparsable_file_should_skip</TestName>
</NamedTestSelector>
<RegexTestSelector>
<RegularExpression>NzbDrone\.Core\.Test\.Integeration\.ServiceIntegerationFixture\..*</RegularExpression>
</RegexTestSelector>
</IgnoredTests>
<HiddenWarnings>PostBuildEventDisabled</HiddenWarnings>
</ProjectConfiguration>

@ -8,6 +8,7 @@
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
<package id="Moq" version="4.0.10827" />
<package id="NBuilder" version="3.0.1.1" />
<package id="NCrunch.Framework" version="1.43.0.23" targetFramework="net40" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
<package id="NLog" version="2.0.0.2000" />
<package id="NUnit" version="2.6.0.12054" />

@ -13,7 +13,9 @@
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
<DefaultTestTimeout>60000</DefaultTestTimeout>
<UseBuildConfiguration />
<ProxyProcessPath />
<UseBuildConfiguration></UseBuildConfiguration>
<UseBuildPlatform />
<ProxyProcessPath></ProxyProcessPath>
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
<HiddenWarnings>PostBuildEventDisabled</HiddenWarnings>
</ProjectConfiguration>

@ -13,7 +13,13 @@
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
<DefaultTestTimeout>60000</DefaultTestTimeout>
<UseBuildConfiguration />
<ProxyProcessPath />
<UseBuildConfiguration></UseBuildConfiguration>
<UseBuildPlatform />
<ProxyProcessPath></ProxyProcessPath>
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
<IgnoredTests>
<RegexTestSelector>
<RegularExpression>.*</RegularExpression>
</RegexTestSelector>
</IgnoredTests>
</ProjectConfiguration>

@ -31,7 +31,7 @@ namespace NzbDrone.Test.Common
protected Mock<RestProvider> MockedRestProvider { get; private set; }
protected string VirtualPath
private string VirtualPath
{
get
{
@ -42,9 +42,15 @@ namespace NzbDrone.Test.Common
}
}
protected string TempFolder { get; private set; }
[SetUp]
public void TestBaseSetup()
{
TempFolder = Path.Combine(Directory.GetCurrentDirectory(), "_temp_" + DateTime.Now.Ticks);
MockedRestProvider = new Mock<RestProvider>();
ReportingService.RestProvider = MockedRestProvider.Object;
ReportingService.SetupExceptronDriver();
@ -62,6 +68,18 @@ namespace NzbDrone.Test.Common
public void TestBaseTearDown()
{
_mocker = null;
try
{
if (Directory.Exists(TempFolder))
{
Directory.Delete(TempFolder, true);
}
}
catch (Exception)
{
}
}
protected void WithStrictMocker()
@ -80,12 +98,6 @@ namespace NzbDrone.Test.Common
.Returns(VirtualPath);
}
protected string TempFolder
{
get { return Path.Combine(Directory.GetCurrentDirectory(), "temp"); }
}
protected string GetTestFilePath(string fileName)
{
return Path.Combine(@".\Files\", fileName);

@ -14,6 +14,7 @@
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
<DefaultTestTimeout>60000</DefaultTestTimeout>
<UseBuildConfiguration></UseBuildConfiguration>
<UseBuildPlatform />
<ProxyProcessPath></ProxyProcessPath>
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
<IgnoredTests>
@ -29,5 +30,8 @@
<NamedTestSelector>
<TestName>NzbDrone.Web.UI.Automation.BasicPageFixture.SettingsPage</TestName>
</NamedTestSelector>
<RegexTestSelector>
<RegularExpression>.*</RegularExpression>
</RegexTestSelector>
</IgnoredTests>
</ProjectConfiguration>

@ -13,7 +13,9 @@
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
<DefaultTestTimeout>60000</DefaultTestTimeout>
<UseBuildConfiguration />
<ProxyProcessPath />
<UseBuildConfiguration></UseBuildConfiguration>
<UseBuildPlatform />
<ProxyProcessPath></ProxyProcessPath>
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
<HiddenWarnings>PostBuildEventDisabled</HiddenWarnings>
</ProjectConfiguration>

@ -1,8 +1,8 @@
<SolutionConfiguration>
<FileVersion>1</FileVersion>
<AutoEnableOnStartup>True</AutoEnableOnStartup>
<AllowParallelTestExecution>false</AllowParallelTestExecution>
<AllowTestsToRunInParallelWithThemselves>false</AllowTestsToRunInParallelWithThemselves>
<AllowParallelTestExecution>true</AllowParallelTestExecution>
<AllowTestsToRunInParallelWithThemselves>true</AllowTestsToRunInParallelWithThemselves>
<FrameworkUtilisationTypeForNUnit>UseDynamicAnalysis</FrameworkUtilisationTypeForNUnit>
<FrameworkUtilisationTypeForGallio>Disabled</FrameworkUtilisationTypeForGallio>
<FrameworkUtilisationTypeForMSpec>Disabled</FrameworkUtilisationTypeForMSpec>

@ -13,7 +13,9 @@
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
<DefaultTestTimeout>60000</DefaultTestTimeout>
<UseBuildConfiguration />
<ProxyProcessPath />
<UseBuildConfiguration></UseBuildConfiguration>
<UseBuildPlatform />
<ProxyProcessPath></ProxyProcessPath>
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
<HiddenWarnings>PostBuildEventDisabled</HiddenWarnings>
</ProjectConfiguration>

@ -13,7 +13,9 @@
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
<DefaultTestTimeout>60000</DefaultTestTimeout>
<UseBuildConfiguration />
<ProxyProcessPath />
<UseBuildConfiguration></UseBuildConfiguration>
<UseBuildPlatform />
<ProxyProcessPath></ProxyProcessPath>
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
<HiddenWarnings>PostBuildEventDisabled</HiddenWarnings>
</ProjectConfiguration>
Loading…
Cancel
Save