Replace console logger with ITestOutputHelper (#64)
This commit is contained in:
parent
1ae7d6dc39
commit
a2914ab483
|
|
@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Testing.xunit;
|
|||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace ServerComparison.FunctionalTests
|
||||
|
|
@ -16,6 +17,13 @@ namespace ServerComparison.FunctionalTests
|
|||
// Uses ports ranging 5061 - 5069.
|
||||
public class HelloWorldTests
|
||||
{
|
||||
private readonly ITestOutputHelper _output;
|
||||
|
||||
public HelloWorldTests(ITestOutputHelper output)
|
||||
{
|
||||
_output = output;
|
||||
}
|
||||
|
||||
// Tests disabled on x86 because of https://github.com/aspnet/Hosting/issues/601
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.Linux)]
|
||||
|
|
@ -63,10 +71,11 @@ namespace ServerComparison.FunctionalTests
|
|||
|
||||
public async Task HelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
||||
{
|
||||
var loggerName = string.Format("HelloWorld:{0}:{1}:{2}:{3}", serverType, runtimeFlavor, architecture, applicationType);
|
||||
Console.WriteLine("Running test for " + loggerName);
|
||||
var logger = new LoggerFactory()
|
||||
.AddConsole()
|
||||
.CreateLogger(string.Format("HelloWorld:{0}:{1}:{2}:{3}", serverType, runtimeFlavor, architecture, applicationType));
|
||||
|
||||
.AddXunit(_output)
|
||||
.CreateLogger(loggerName);
|
||||
using (logger.BeginScope("HelloWorldTest"))
|
||||
{
|
||||
var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Testing.xunit;
|
|||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace ServerComparison.FunctionalTests
|
||||
|
|
@ -18,6 +19,13 @@ namespace ServerComparison.FunctionalTests
|
|||
// Uses ports ranging 5050 - 5060.
|
||||
public class NtlmAuthenticationTests
|
||||
{
|
||||
private readonly ITestOutputHelper _output;
|
||||
|
||||
public NtlmAuthenticationTests(ITestOutputHelper output)
|
||||
{
|
||||
_output = output;
|
||||
}
|
||||
|
||||
[ConditionalTheory, Trait("ServerComparison.FunctionalTests", "ServerComparison.FunctionalTests")]
|
||||
[OSSkipCondition(OperatingSystems.Linux)]
|
||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||
|
|
@ -29,9 +37,11 @@ namespace ServerComparison.FunctionalTests
|
|||
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5053/", ApplicationType.Standalone)]
|
||||
public async Task NtlmAuthentication(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
||||
{
|
||||
var loggerName = string.Format("Ntlm:{0}:{1}:{2}:{3}", serverType, runtimeFlavor, architecture, applicationType);
|
||||
Console.WriteLine("Running test for " + loggerName);
|
||||
var logger = new LoggerFactory()
|
||||
.AddConsole()
|
||||
.CreateLogger(string.Format("Ntlm:{0}:{1}:{2}:{3}", serverType, runtimeFlavor, architecture, applicationType));
|
||||
.AddXunit(_output)
|
||||
.CreateLogger(loggerName);
|
||||
|
||||
using (logger.BeginScope("NtlmAuthenticationTest"))
|
||||
{
|
||||
|
|
@ -143,4 +153,4 @@ namespace ServerComparison.FunctionalTests
|
|||
#elif NETCOREAPP1_1
|
||||
#else
|
||||
#error target frameworks need to be updated
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ using Microsoft.DotNet.PlatformAbstractions;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace ServerComparison.FunctionalTests
|
||||
|
|
@ -24,6 +25,12 @@ namespace ServerComparison.FunctionalTests
|
|||
{
|
||||
// NGinx's default min size is 20 bytes
|
||||
private static readonly string HelloWorldBody = "Hello World;" + new string('a', 20);
|
||||
private readonly ITestOutputHelper _output;
|
||||
|
||||
public ResponseCompressionTests(ITestOutputHelper output)
|
||||
{
|
||||
_output = output;
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.Linux)]
|
||||
|
|
@ -119,9 +126,11 @@ namespace ServerComparison.FunctionalTests
|
|||
|
||||
public async Task ResponseCompression(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, Func<HttpClient, ILogger, Task> scenario, ApplicationType applicationType, bool hostCompression)
|
||||
{
|
||||
var loggerName = string.Format("ResponseCompression:{0}:{1}:{2}:{3}", serverType, runtimeFlavor, architecture, applicationType);
|
||||
Console.WriteLine("Running test for " + loggerName);
|
||||
var logger = new LoggerFactory()
|
||||
.AddConsole()
|
||||
.CreateLogger(string.Format("ResponseCompression:{0}:{1}:{2}:{3}", serverType, runtimeFlavor, architecture, applicationType));
|
||||
.AddXunit(_output)
|
||||
.CreateLogger(loggerName);
|
||||
|
||||
using (logger.BeginScope("ResponseCompressionTest"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ using Microsoft.DotNet.PlatformAbstractions;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace ServerComparison.FunctionalTests
|
||||
|
|
@ -19,6 +20,13 @@ namespace ServerComparison.FunctionalTests
|
|||
// Uses ports ranging 5080 - 5099.
|
||||
public class ResponseTests
|
||||
{
|
||||
private readonly ITestOutputHelper _output;
|
||||
|
||||
public ResponseTests(ITestOutputHelper output)
|
||||
{
|
||||
_output = output;
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.Linux)]
|
||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||
|
|
@ -156,9 +164,11 @@ namespace ServerComparison.FunctionalTests
|
|||
|
||||
public async Task ResponseFormats(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, Func<HttpClient, ILogger, Task> scenario, ApplicationType applicationType)
|
||||
{
|
||||
var loggerName = string.Format("ResponseFormats:{0}:{1}:{2}:{3}", serverType, runtimeFlavor, architecture, applicationType);
|
||||
Console.WriteLine("Running test for " + loggerName);
|
||||
var logger = new LoggerFactory()
|
||||
.AddConsole()
|
||||
.CreateLogger(string.Format("ResponseFormats:{0}:{1}:{2}:{3}", serverType, runtimeFlavor, architecture, applicationType));
|
||||
.AddXunit(_output)
|
||||
.CreateLogger(loggerName);
|
||||
|
||||
using (logger.BeginScope("ResponseFormatsTest"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(AspNetCoreLabsVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(AspNetCoreVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(AspNetCoreVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="$(AspNetCoreVersion)" />
|
||||
<PackageReference Include="Microsoft.Dotnet.PlatformAbstractions" Version="$(AspNetCoreVersion)" />
|
||||
<PackageReference Include="Microsoft.Net.Http.Headers" Version="$(AspNetCoreVersion)" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue