Merge branch 'netcore/bugfix/azure-devops-tests' into netcore/netcore

This commit is contained in:
Bjarke Berg
2020-10-27 11:57:38 +01:00
8 changed files with 69 additions and 17 deletions

View File

@@ -25,14 +25,14 @@ namespace Umbraco.Tests.Common.Builders
private int? _id;
private Guid? _key;
private DateTime? _updateDate;
private string _affectedDetails;
private int? _affectedUserId;
private string _eventDetails;
private string _eventType;
private string _performingDetails;
private string _performingIp;
private DateTime? _eventDateUtc;
private int? _performingUserId;
private string _affectedDetails = null;
private int? _affectedUserId = null;
private string _eventDetails = null;
private string _eventType = null;
private string _performingDetails = null;
private string _performingIp = null;
private DateTime? _eventDateUtc = null;
private int? _performingUserId = null;
public AuditEntryBuilder(TParent parentBuilder) : base(parentBuilder)
{

View File

@@ -15,8 +15,8 @@ namespace Umbraco.Tests.Common.Builders
private string _name;
private CultureInfo _cultureInfo;
private bool? _save;
private bool? _publish;
private bool? _save = null;
private bool? _publish = null;
public ContentVariantSaveBuilder(TParent parentBuilder) : base(parentBuilder)
{

View File

@@ -6,10 +6,9 @@
<ItemGroup>
<PackageReference Include="AutoFixture.AutoMoq" Version="4.14.0" />
<PackageReference Include="MiniProfiler" Version="4.1.0" />
<PackageReference Include="MiniProfiler.AspNetCore" Version="4.2.1" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="AutoFixture.NUnit3" Version="4.14.0" />
<PackageReference Include="MiniProfiler" Version="4.2.1" />
<PackageReference Include="Moq" Version="4.14.5" />
<PackageReference Include="nunit" Version="3.12.0" />
</ItemGroup>

View File

@@ -21,14 +21,13 @@ using Umbraco.Tests.Testing;
using Umbraco.Web;
using Umbraco.Web.Common.Builder;
using Umbraco.Web.Common.Controllers;
using Umbraco.Web.Editors;
using Microsoft.Extensions.Hosting;
using Umbraco.Web.BackOffice.Controllers;
namespace Umbraco.Tests.Integration.TestServerTest
{
[TestFixture]
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest, Logger = UmbracoTestOptions.Logger.Console, Boot = false)]
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest, Logger = UmbracoTestOptions.Logger.Console, Boot = true)]
public abstract class UmbracoTestServerTestBase : UmbracoIntegrationTest
{
[SetUp]

View File

@@ -26,6 +26,7 @@ using System.Collections.Generic;
using Microsoft.Extensions.Configuration;
using System.Data.SqlClient;
using System.Data.Common;
using System.Diagnostics;
using System.IO;
using Umbraco.Core.Configuration.Models;
using Microsoft.Extensions.Options;
@@ -75,17 +76,23 @@ namespace Umbraco.Tests.Integration.Testing
_testTeardown = null;
FirstTestInFixture = false;
FirstTestInSession = false;
TestContext.Progress.Write($" {TestContext.CurrentContext.Result.Outcome.Status}");
}
[SetUp]
public virtual void Setup()
{
TestContext.Progress.Write($"Start test {_testCount++}: {TestContext.CurrentContext.Test.Name}");
var hostBuilder = CreateHostBuilder();
var host = hostBuilder.StartAsync().GetAwaiter().GetResult();
var host = hostBuilder.Start();
Services = host.Services;
var app = new ApplicationBuilder(host.Services);
Configure(app); //Takes around 200 ms
Configure(app);
OnFixtureTearDown(() => host.Dispose());
}
@@ -477,5 +484,6 @@ namespace Umbraco.Tests.Integration.Testing
protected static bool FirstTestInSession = true;
protected bool FirstTestInFixture = true;
private static int _testCount = 1;
}
}

View File

@@ -0,0 +1,21 @@
using NUnit.Framework;
using Umbraco.Tests.Integration.Testing;
namespace Umbraco.Tests.Integration
{
[TestFixture]
public class Tests : UmbracoIntegrationTest
{
[Test]
public void Test__Stupid_test_that_only_is_used_to_check_how_long_time_we_spend_int_setup_and_teardown1()
{
}
[Test]
public void Test__Stupid_test_that_only_is_used_to_check_how_long_time_we_spend_int_setup_and_teardown2()
{
}
}
}

View File

@@ -14,6 +14,7 @@
<Compile Remove="Views\**" />
<EmbeddedResource Remove="Views\**" />
<None Remove="Views\**" />
<None Remove="create_slicing_filter_condition.sh" />
</ItemGroup>
<ItemGroup>
@@ -39,7 +40,6 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Moq" Version="4.14.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PrivateAssets>all</PrivateAssets>

View File

@@ -0,0 +1,25 @@
#!/bin/bash
filterProperty="Name"
tests=$1
testCount=${#tests[@]}
totalAgents=$SYSTEM_TOTALJOBSINPHASE
agentNumber=$SYSTEM_JOBPOSITIONINPHASE
if [ $totalAgents -eq 0 ]; then totalAgents=1; fi
if [ -z "$agentNumber" ]; then agentNumber=1; fi
echo "Total agents: $totalAgents"
echo "Agent number: $agentNumber"
echo "Total tests: $testCount"
echo "Target tests:"
for ((i=$agentNumber; i <= $testCount;i=$((i+$totalAgents)))); do
targetTestName=${tests[$i -1]}
echo "$targetTestName"
filter+="|${filterProperty}=${targetTestName}"
done
filter=${filter#"|"}
echo "##vso[task.setvariable variable=targetTestsFilter]$filter"