Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Changes to allow for using NUnit.Engine 4 pre-release to support Net7… #988

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var configuration = Argument("configuration", "Release");
// SET PACKAGE VERSION
//////////////////////////////////////////////////////////////////////

var version = "4.3.0";
var version = "4.3.0-alpha-net7.4";
var modifier = "";

var dbgSuffix = configuration.ToLower() == "debug" ? "-dbg" : "";
Expand Down
1 change: 1 addition & 0 deletions nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<packageSources>
<clear />
<!--<add key="Local" value="C:\nuget" />-->
<!--<add key="dev" value="https://www.myget.org/F/nunit/api/v3/index.json" />-->
<add key="nuget" value="https://api.nuget.org/v3/index.json"/>
</packageSources>
</configuration>
2 changes: 1 addition & 1 deletion nuget/NUnit3TestAdapter.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
For VS 2017 and forward, you should add this package to every test project in your solution. (Earlier versions only require a single adapter package per solution.)
</description>
<releaseNotes>See https://docs.nunit.org/articles/vs-test-adapter/Adapter-Release-Notes.html </releaseNotes>
<copyright>Copyright (c) 2011-2021 Charlie Poole, 2014-2021 Terje Sandstrom</copyright>
<copyright>Copyright (c) 2011-2021 Charlie Poole, 2014-2022 Terje Sandstrom</copyright>
<language>en-US</language>
<tags>test visualstudio testadapter nunit nunit3 dotnet</tags>

Expand Down
9 changes: 8 additions & 1 deletion src/NUnitTestAdapter/NUnit.TestAdapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
<SourceLinkCreate>true</SourceLinkCreate>
</PropertyGroup>

<PropertyGroup>
<RestoreAdditionalProjectSource>https://www.myget.org/F/nunit/api/v3/index.json</RestoreAdditionalProjectSource>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nunit.engine" Version="3.16.0-alpha.2" />
</ItemGroup>

<PropertyGroup>
<PackageId>NUnit3TestAdapter</PackageId>
<Authors>Charlie Poole, Terje Sandstrom</Authors>
Expand All @@ -24,7 +32,6 @@

<ItemGroup>
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.3" PrivateAssets="All" />
<PackageReference Include="nunit.engine" Version="3.15.0" />
<PackageReference Include="TestCentric.Metadata" Version="1.7.1" Aliases="TestCentric" />
</ItemGroup>

Expand Down
7 changes: 4 additions & 3 deletions src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ***********************************************************************
// Copyright (c) 2020-2021 Charlie Poole, Terje Sandstrom
// Copyright (c) 2020-2021 Charlie Poole, 2020-2022 Terje Sandstrom
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -412,8 +412,9 @@ private NUnitDiscoveryTestAssembly ExtractTestAssembly(XElement node, NUnitDisco
private static BaseProperties ExtractSuiteBasePropertiesClass(XElement node)
{
string dId = node.Attribute(NUnitXmlAttributeNames.Id).Value;
string dName = node.Attribute(NUnitXmlAttributeNames.Name).Value;
string dFullname = node.Attribute(NUnitXmlAttributeNames.Fullname).Value;
// test-run no longer has a name/fullname property
string dName = node.Attribute(NUnitXmlAttributeNames.Name)?.Value ?? "Unnamed";
string dFullname = node.Attribute(NUnitXmlAttributeNames.Fullname)?.Value ?? "Unnamed";
var dRunstate = ExtractRunState(node);
const char apo = '\'';
var tcs = node.Attribute(NUnitXmlAttributeNames.Testcasecount)?.Value.Trim(apo);
Expand Down
10 changes: 10 additions & 0 deletions src/NUnitTestAdapterTests/NUnit.TestAdapter.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup>
<RestoreAdditionalProjectSource>https://www.myget.org/F/nunit/api/v3/index.json</RestoreAdditionalProjectSource>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nunit.engine" Version="3.16.0-alpha.2" />
</ItemGroup>



<ItemGroup>
<PackageReference Include="NSubstitute" Version="4.3.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Linq;
using System.Xml;

using NSubstitute;

using NUnit.Framework;
using NUnit.VisualStudio.TestAdapter.NUnitEngine;
// ReSharper disable StringLiteralTypo
Expand All @@ -13,8 +15,8 @@ public class NUnitDiscoveryTests
private IAdapterSettings settings;

private const string FullDiscoveryXml =
@"<test-run id='2' name='CSharpTestDemo.dll' fullname='D:\repos\NUnit\nunit3-vs-adapter-demo\solutions\vs2017\CSharpTestDemo\bin\Debug\CSharpTestDemo.dll' testcasecount='108'>
<test-suite type='Assembly' id='0-1157' name='CSharpTestDemo.dll' fullname='D:\repos\NUnit\nunit3-vs-adapter-demo\solutions\vs2017\CSharpTestDemo\bin\Debug\CSharpTestDemo.dll' runstate='Runnable' testcasecount='108'>
@"<test-run id='2' testcasecount='108'>
<test-suite type='Assembly' id='0-1157' name='CSharpTestDemo.dll' fullname='D:\repos\NUnit\nunit3-vs-adapter-demo\solutions\vs2017\CSharpTestDemo\bin\Debug\CSharpTestDemo.dll' runstate='Runnable' testcasecount='108'>
<properties>
<property name='_PID' value='9856' />
<property name='_APPDOMAIN' value='domain-807ad471-CSharpTestDemo.dll' />
Expand Down
4 changes: 0 additions & 4 deletions src/NUnitTestAdapterTests/TestAdapterUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,9 @@ private static void InitializeForTesting(NUnitTestAdapter adapter)
adapter.NUnitEngineAdapter.InternalEngineCreated += engine =>
{
var concreteEngineType = (NUnit.Engine.TestEngine)engine;
concreteEngineType.Services.Add(new SettingsService(true));
concreteEngineType.Services.Add(new ExtensionService());
concreteEngineType.Services.Add(new DriverService());
concreteEngineType.Services.Add(new RecentFilesService());
concreteEngineType.Services.Add(new ProjectService());
concreteEngineType.Services.Add(new RuntimeFrameworkService());
concreteEngineType.Services.Add(new DefaultTestRunnerFactory());
concreteEngineType.Services.Add(new TestAgency()); // "TestAgency for " + TestContext.CurrentContext.Test.Name, 0));
concreteEngineType.Services.Add(new ResultService());
concreteEngineType.Services.Add(new TestFilterService());
Expand Down