Skip to content

Commit 2937331

Browse files
committed
some updates
1 parent e454bc7 commit 2937331

23 files changed

+221
-469
lines changed

src/Components/test/E2ETest/Infrastructure/AssemblyInfo.AssemblyFixtures.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using Microsoft.AspNetCore.E2ETesting;
5+
using Microsoft.AspNetCore.Testing;
56
using Xunit;
67

7-
[assembly: TestFramework("Microsoft.AspNetCore.E2ETesting.XunitTestFrameworkWithAssemblyFixture", "Microsoft.AspNetCore.Components.E2ETests")]
88
[assembly: AssemblyFixture(typeof(SeleniumStandaloneServer))]
99
[assembly: AssemblyFixture(typeof(SauceConnectServer))]

src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
<OutputPath />
2121

22-
<GenerateLoggingTestingAssemblyAttributes>false</GenerateLoggingTestingAssemblyAttributes>
23-
2422
<!-- This project references the shared framework transitively. Prevent restore errors by setting this flag. -->
2523
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
2624
</PropertyGroup>

src/ProjectTemplates/BlazorTemplates.Tests/AssemblyInfo.AssemblyFixtures.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using Microsoft.AspNetCore.E2ETesting;
5+
using Microsoft.AspNetCore.Testing;
56
using Templates.Test.Helpers;
6-
using Xunit;
77

8-
[assembly: TestFramework("Microsoft.AspNetCore.E2ETesting.XunitTestFrameworkWithAssemblyFixture", "BlazorTemplates.Tests")]
9-
10-
[assembly: Microsoft.AspNetCore.E2ETesting.AssemblyFixture(typeof(ProjectFactoryFixture))]
11-
[assembly: Microsoft.AspNetCore.E2ETesting.AssemblyFixture(typeof(SeleniumStandaloneServer))]
8+
[assembly: AssemblyFixture(typeof(ProjectFactoryFixture))]
9+
[assembly: AssemblyFixture(typeof(SeleniumStandaloneServer))]
1210

src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<!-- Shared testing infrastructure for running E2E tests using selenium -->
44
<Import Project="$(SharedSourceRoot)E2ETesting\E2ETesting.props" />
@@ -22,7 +22,6 @@
2222
<TestTemplateCreationFolder>TestTemplates\</TestTemplateCreationFolder>
2323
<TestPackageRestorePath>$([MSBuild]::EnsureTrailingSlash('$(RepoRoot)'))obj\template-restore\</TestPackageRestorePath>
2424
<TestTemplateTestsProps>TemplateTests.props</TestTemplateTestsProps>
25-
<GenerateLoggingTestingAssemblyAttributes>false</GenerateLoggingTestingAssemblyAttributes>
2625
<TestDependsOnAspNetRuntime>true</TestDependsOnAspNetRuntime>
2726
</PropertyGroup>
2827

@@ -43,11 +42,6 @@
4342
<Reference Include="Microsoft.NET.Sdk.Razor" ReferenceOutputAssembly="false" SkipGetTargetFrameworkProperties="true" />
4443
</ItemGroup>
4544

46-
<PropertyGroup>
47-
<PreserveExistingLogsInOutput Condition="'$(PreserveExistingLogsInOutput)' == '' AND '$(ContinuousIntegrationBuild)' == 'true'">true</PreserveExistingLogsInOutput>
48-
<PreserveExistingLogsInOutput Condition="'$(PreserveExistingLogsInOutput)' == ''">false</PreserveExistingLogsInOutput>
49-
</PropertyGroup>
50-
5145
<ItemGroup>
5246
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
5347
<_Parameter1>DotNetEfFullPath</_Parameter1>
@@ -65,11 +59,6 @@
6559
<_Parameter1>ContinuousIntegrationBuild</_Parameter1>
6660
<_Parameter2>true</_Parameter2>
6761
</AssemblyAttribute>
68-
<AssemblyAttribute Include="Microsoft.AspNetCore.Testing.TestFrameworkFileLoggerAttribute">
69-
<_Parameter1>$(PreserveExistingLogsInOutput)</_Parameter1>
70-
<_Parameter2>$(TargetFramework)</_Parameter2>
71-
<_Parameter3></_Parameter3>
72-
</AssemblyAttribute>
7362
</ItemGroup>
7463

7564
<Target Name="PrepareForTest" BeforeTargets="GetAssemblyAttributes" Condition="$(DesignTimeBuild) != true">

src/ProjectTemplates/Shared/ProjectFactoryFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public async Task<Project> GetOrCreateProject(string projectKey, ITestOutputHelp
5555
}
5656

5757
private static string GetTemplateFolderBasePath(Assembly assembly) =>
58-
(string.IsNullOrEmpty(Environment.GetEnvironmentVariable("HELIX_DIR")))
58+
(string.IsNullOrEmpty(Environment.GetEnvironmentVariable("HELIX_DIR")))
5959
? assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
6060
.Single(a => a.Key == "TestTemplateCreationFolder")
6161
.Value

src/ProjectTemplates/Shared/TestOutputLogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Templates.Test.Helpers
88
{
99
internal class TestOutputLogger : ITestOutputHelper
1010
{
11-
private ILogger _logger;
11+
private readonly ILogger _logger;
1212

1313
public TestOutputLogger(ILogger logger)
1414
{

src/ProjectTemplates/test/AssemblyInfo.AssemblyFixtures.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
using Microsoft.AspNetCore.E2ETesting;
55
using Microsoft.AspNetCore.Testing;
66
using Templates.Test.Helpers;
7-
using Xunit;
87

9-
[assembly: TestFramework("Microsoft.AspNetCore.E2ETesting.XunitTestFrameworkWithAssemblyFixture", "ProjectTemplates.Tests")]
10-
11-
[assembly: Microsoft.AspNetCore.E2ETesting.AssemblyFixture(typeof(ProjectFactoryFixture))]
12-
[assembly: Microsoft.AspNetCore.E2ETesting.AssemblyFixture(typeof(SeleniumStandaloneServer))]
8+
[assembly: AssemblyFixture(typeof(ProjectFactoryFixture))]
9+
[assembly: AssemblyFixture(typeof(SeleniumStandaloneServer))]

src/ProjectTemplates/test/BaselineTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace Templates.Test
1717
{
18-
public class BaselineTest
18+
public class BaselineTest : LoggedTest
1919
{
2020
private static readonly Regex TemplateNameRegex = new Regex(
2121
"new (?<template>[a-zA-Z]+)",
@@ -32,10 +32,10 @@ public class BaselineTest
3232
RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.Singleline,
3333
TimeSpan.FromSeconds(1));
3434

35-
public BaselineTest(ProjectFactoryFixture projectFactory, ITestOutputHelper output)
35+
public BaselineTest(ProjectFactoryFixture projectFactory)
3636
{
3737
ProjectFactory = projectFactory;
38-
Output = output;
38+
Output = new TestOutputLogger(Logger);
3939
}
4040

4141
public Project Project { get; set; }

src/ProjectTemplates/test/ByteOrderMarkTest.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55
using System.IO;
66
using System.Linq;
77
using System.Text;
8+
using Microsoft.AspNetCore.Testing;
9+
using Templates.Test.Helpers;
810
using Xunit;
911
using Xunit.Abstractions;
1012

1113
namespace Templates.Test
1214
{
13-
public class ByteOrderMarkTest
15+
public class ByteOrderMarkTest : LoggedTest
1416
{
1517
private readonly ITestOutputHelper _output;
1618

17-
public ByteOrderMarkTest(ITestOutputHelper output)
19+
public ByteOrderMarkTest()
1820
{
19-
_output = output;
21+
_output = new TestOutputLogger(Logger);
2022
}
2123

2224
[Theory]

src/ProjectTemplates/test/EmptyWebTemplateTest.cs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@
99

1010
namespace Templates.Test
1111
{
12-
public class EmptyWebTemplateTest
12+
public class EmptyWebTemplateTest : LoggedTest
1313
{
14-
public EmptyWebTemplateTest(ProjectFactoryFixture projectFactory, ITestOutputHelper output)
14+
public EmptyWebTemplateTest(ProjectFactoryFixture projectFactory)
1515
{
1616
ProjectFactory = projectFactory;
17-
Output = output;
17+
Output = new TestOutputLogger(Logger);
1818
}
1919

20-
public Project Project { get; set; }
21-
2220
public ProjectFactoryFixture ProjectFactory { get; }
2321

2422
public ITestOutputHelper Output { get; }
@@ -38,41 +36,41 @@ public async Task EmptyWebTemplateFSharp()
3836

3937
private async Task EmtpyTemplateCore(string languageOverride)
4038
{
41-
Project = await ProjectFactory.GetOrCreateProject("empty" + (languageOverride == "F#" ? "fsharp" : "csharp"), Output);
39+
var project = await ProjectFactory.GetOrCreateProject("empty" + (languageOverride == "F#" ? "fsharp" : "csharp"), Output);
4240

43-
var createResult = await Project.RunDotNetNewAsync("web", language: languageOverride);
44-
Assert.True(0 == createResult.ExitCode, ErrorMessages.GetFailedProcessMessage("create/restore", Project, createResult));
41+
var createResult = await project.RunDotNetNewAsync("web", language: languageOverride);
42+
Assert.True(0 == createResult.ExitCode, ErrorMessages.GetFailedProcessMessage("create/restore", project, createResult));
4543

4644
// Avoid the F# compiler. See https://github.com/dotnet/aspnetcore/issues/14022
4745
if (languageOverride != null)
4846
{
4947
return;
5048
}
5149

52-
var publishResult = await Project.RunDotNetPublishAsync();
53-
Assert.True(0 == publishResult.ExitCode, ErrorMessages.GetFailedProcessMessage("publish", Project, publishResult));
50+
var publishResult = await project.RunDotNetPublishAsync();
51+
Assert.True(0 == publishResult.ExitCode, ErrorMessages.GetFailedProcessMessage("publish", project, publishResult));
5452

5553
// Run dotnet build after publish. The reason is that one uses Config = Debug and the other uses Config = Release
5654
// The output from publish will go into bin/Release/netcoreappX.Y/publish and won't be affected by calling build
5755
// later, while the opposite is not true.
5856

59-
var buildResult = await Project.RunDotNetBuildAsync();
60-
Assert.True(0 == buildResult.ExitCode, ErrorMessages.GetFailedProcessMessage("build", Project, buildResult));
57+
var buildResult = await project.RunDotNetBuildAsync();
58+
Assert.True(0 == buildResult.ExitCode, ErrorMessages.GetFailedProcessMessage("build", project, buildResult));
6159

62-
using (var aspNetProcess = Project.StartBuiltProjectAsync())
60+
using (var aspNetProcess = project.StartBuiltProjectAsync())
6361
{
6462
Assert.False(
6563
aspNetProcess.Process.HasExited,
66-
ErrorMessages.GetFailedProcessMessageOrEmpty("Run built project", Project, aspNetProcess.Process));
64+
ErrorMessages.GetFailedProcessMessageOrEmpty("Run built project", project, aspNetProcess.Process));
6765

6866
await aspNetProcess.AssertOk("/");
6967
}
7068

71-
using (var aspNetProcess = Project.StartPublishedProjectAsync())
69+
using (var aspNetProcess = project.StartPublishedProjectAsync())
7270
{
7371
Assert.False(
7472
aspNetProcess.Process.HasExited,
75-
ErrorMessages.GetFailedProcessMessageOrEmpty("Run published project", Project, aspNetProcess.Process));
73+
ErrorMessages.GetFailedProcessMessageOrEmpty("Run published project", project, aspNetProcess.Process));
7674

7775
await aspNetProcess.AssertOk("/");
7876
}

0 commit comments

Comments
 (0)