Distribute SPA templates over multiple test classes so they can run in parallel
This commit is contained in:
parent
7961894771
commit
62a8eafe51
|
|
@ -0,0 +1,24 @@
|
||||||
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
namespace Templates.Test.SpaTemplateTest
|
||||||
|
{
|
||||||
|
public class AngularTemplateTest : SpaTemplateTestBase
|
||||||
|
{
|
||||||
|
public AngularTemplateTest(ITestOutputHelper output) : base(output)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalFact]
|
||||||
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
|
// Just use 'angular' as representative for .NET 4.6.1 coverage, as
|
||||||
|
// the client-side code isn't affected by the .NET runtime choice
|
||||||
|
public void AngularTemplate_Works_NetFramework()
|
||||||
|
=> SpaTemplateImpl("net461", "angular");
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AngularTemplate_Works_NetCore()
|
||||||
|
=> SpaTemplateImpl(null, "angular");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
namespace Templates.Test.SpaTemplateTest
|
||||||
|
{
|
||||||
|
public class AureliaTemplateTest : SpaTemplateTestBase
|
||||||
|
{
|
||||||
|
public AureliaTemplateTest(ITestOutputHelper output) : base(output)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AureliaTemplate_Works_NetCore()
|
||||||
|
=> SpaTemplateImpl(null, "aurelia");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
namespace Templates.Test.SpaTemplateTest
|
||||||
|
{
|
||||||
|
public class KnockoutTemplateTest : SpaTemplateTestBase
|
||||||
|
{
|
||||||
|
public KnockoutTemplateTest(ITestOutputHelper output) : base(output)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void KnockoutTemplate_Works_NetCore()
|
||||||
|
=> SpaTemplateImpl(null, "knockout");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
namespace Templates.Test.SpaTemplateTest
|
||||||
|
{
|
||||||
|
public class ReactReduxTemplateTest : SpaTemplateTestBase
|
||||||
|
{
|
||||||
|
public ReactReduxTemplateTest(ITestOutputHelper output) : base(output)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ReactReduxTemplate_Works_NetCore()
|
||||||
|
=> SpaTemplateImpl(null, "reactredux");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
namespace Templates.Test.SpaTemplateTest
|
||||||
|
{
|
||||||
|
public class ReactTemplateTest : SpaTemplateTestBase
|
||||||
|
{
|
||||||
|
public ReactTemplateTest(ITestOutputHelper output) : base(output)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ReactTemplate_Works_NetCore()
|
||||||
|
=> SpaTemplateImpl(null, "react");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,40 +1,24 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Templates.Test.Helpers;
|
using Templates.Test.Helpers;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace Templates.Test
|
namespace Templates.Test.SpaTemplateTest
|
||||||
{
|
{
|
||||||
public class SpaTemplateTest : TemplateTestBase
|
public class SpaTemplateTestBase : TemplateTestBase
|
||||||
{
|
{
|
||||||
public SpaTemplateTest(ITestOutputHelper output) : base(output)
|
public SpaTemplateTestBase(ITestOutputHelper output) : base(output)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
// Rather than using [Theory] to pass each of the different values for 'template',
|
||||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
// it's important to distribute the SPA template tests over different test classes
|
||||||
// Just use 'angular' as representative for .NET 4.6.1 coverage, as
|
// so they can be run in parallel. Xunit doesn't parallelize within a test class.
|
||||||
// the client-side code isn't affected by the .NET runtime choice
|
protected void SpaTemplateImpl(string targetFrameworkOverride, string template)
|
||||||
[InlineData("angular")]
|
|
||||||
public void SpaTemplate_Works_NetFramework(string template)
|
|
||||||
=> SpaTemplateImpl("net461", template);
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("angular")]
|
|
||||||
[InlineData("react")]
|
|
||||||
[InlineData("reactredux")]
|
|
||||||
[InlineData("aurelia")]
|
|
||||||
[InlineData("knockout")]
|
|
||||||
[InlineData("vue")]
|
|
||||||
public void SpaTemplate_Works_NetCore(string template)
|
|
||||||
=> SpaTemplateImpl(null, template);
|
|
||||||
|
|
||||||
private void SpaTemplateImpl(string targetFrameworkOverride, string template)
|
|
||||||
{
|
{
|
||||||
RunDotNetNew(template, targetFrameworkOverride);
|
RunDotNetNew(template, targetFrameworkOverride);
|
||||||
RunNpmInstall();
|
RunNpmInstall();
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
namespace Templates.Test.SpaTemplateTest
|
||||||
|
{
|
||||||
|
public class VueTemplateTest : SpaTemplateTestBase
|
||||||
|
{
|
||||||
|
public VueTemplateTest(ITestOutputHelper output) : base(output)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void VueTemplate_Works_NetCore()
|
||||||
|
=> SpaTemplateImpl(null, "vue");
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue