From 5a6334a8d42bd0fb710f5d06b7f6f74d5d44c3ae Mon Sep 17 00:00:00 2001 From: Charlie Poole Date: Mon, 15 Jul 2024 15:11:32 -0700 Subject: [PATCH] Update recipe version --- GitVersion.yml | 2 +- build.cake | 26 ++++++++++++++----- src/mock-assembly/MockAssembly.cs | 12 --------- src/tests/Program.cs | 19 ++++++++++++++ src/tests/nunit-v2-result-writer.tests.csproj | 5 ++-- 5 files changed, 42 insertions(+), 22 deletions(-) create mode 100644 src/tests/Program.cs diff --git a/GitVersion.yml b/GitVersion.yml index 9713795..22f9a64 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,4 +1,4 @@ -next-version: 3.7.0 +next-version: 3.8.0 mode: ContinuousDelivery legacy-semver-padding: 5 build-metadata-padding: 5 diff --git a/build.cake b/build.cake index dba3ba9..8ff9211 100644 --- a/build.cake +++ b/build.cake @@ -2,10 +2,9 @@ #tool nuget:?package=NUnit.ConsoleRunner&version=3.17.0 #tool nuget:?package=NUnit.ConsoleRunner&version=3.18.0-dev00037 #tool nuget:?package=NUnit.ConsoleRunner.NetCore&version=3.18.0-dev00037 -#tool nuget:?package=NUnit.Extension.NUnitProjectLoader&version=3.6.0 // Load the recipe -#load nuget:?package=NUnit.Cake.Recipe&version=1.0.0-dev00001 +#load nuget:?package=NUnit.Cake.Recipe&version=1.0.1-dev00001 // Comment out above line and uncomment below for local tests of recipe changes //#load ../NUnit.Cake.Recipe/recipe/*.cake @@ -16,7 +15,7 @@ BuildSettings.Initialize( "nunit-v2-result-writer", solutionFile: "nunit-v2-result-writer.sln", unitTestRunner: new NUnitLiteRunner(), - unitTests: "**/*.Tests.exe"); + unitTests: "**/*.tests.exe"); const string NUNIT3_RESULT_FILE = "TestResult.xml"; const string NUNIT2_RESULT_FILE = "NUnit2TestResult.xml"; @@ -33,7 +32,17 @@ PackageTest[] PackageTests = new PackageTest[] } ), new PackageTest( - 1, "TwoAssemblies", + 1, "SingleAssembly_NetCoreRunner", + "Run mock-assembly under NetCore runner", + $"net6.0/mock-assembly.dll --result={NUNIT3_RESULT_FILE} --result={NUNIT2_RESULT_FILE};format=nunit2", + new ExpectedResult("Failed") + { + Assemblies = new[] { new ExpectedAssemblyResult("mock-assembly.dll", "netcore-6.0") } + }, + new IPackageTestRunner[] { (IPackageTestRunner)new NUnitNetCoreConsoleRunner("3.18.0-dev00037") } ), + + new PackageTest( + 1, "TwoAssembliesTogether", "Run two copies of mock-assembly", $"net462/mock-assembly.dll net6.0/mock-assembly.dll --result={NUNIT3_RESULT_FILE} --result={NUNIT2_RESULT_FILE};format=nunit2", new ExpectedResult("Failed") { @@ -54,13 +63,16 @@ PackageTest[] PackageTests = new PackageTest[] new ExpectedAssemblyResult("mock-assembly.dll", "netcore-6.0") } }, - KnownExtensions.NUnitProjectLoader ) + KnownExtensions.NUnitProjectLoader.SetVersion("3.8.0") ) }; ////////////////////////////////////////////////////////////////////// // NUGET PACKAGE ////////////////////////////////////////////////////////////////////// +private TestRunnerSource DEFAULT_TEST_RUNNER_SOURCE = new TestRunnerSource ( + new NUnitConsoleRunner("3.17.0"), new NUnitConsoleRunner("3.15.5"), new NUnitConsoleRunner("3.18.0-dev00037") ); + BuildSettings.Packages.Add( new NuGetPackage( "NUnit.Extension.NUnitV2ResultWriter", @@ -72,7 +84,7 @@ BuildSettings.Packages.Add( HasDirectory("tools/net6.0").WithFile("nunit-v2-result-writer.dll"), HasDirectory("tools/net6.0").WithFile("nunit.engine.api.dll") }, tests: PackageTests, - testRunnerSource: new TestRunnerSource(new NUnitConsoleRunner("3.17.0"), new NUnitConsoleRunner("3.15.5"), new NUnitConsoleRunner("3.18.0-dev00037")) + testRunnerSource: DEFAULT_TEST_RUNNER_SOURCE )); ////////////////////////////////////////////////////////////////////// @@ -89,7 +101,7 @@ BuildSettings.Packages.Add( HasDirectory("tools/net6.0").WithFile("nunit-v2-result-writer.dll"), HasDirectory("tools/net6.0").WithFile("nunit.engine.api.dll") }, tests: PackageTests, - testRunnerSource: new TestRunnerSource(new NUnitConsoleRunner("3.17.0"), new NUnitConsoleRunner("3.15.5"), new NUnitConsoleRunner("3.18.0-dev00037")) + testRunnerSource: DEFAULT_TEST_RUNNER_SOURCE )); ////////////////////////////////////////////////////////////////////// diff --git a/src/mock-assembly/MockAssembly.cs b/src/mock-assembly/MockAssembly.cs index e348fc1..610ade1 100644 --- a/src/mock-assembly/MockAssembly.cs +++ b/src/mock-assembly/MockAssembly.cs @@ -54,18 +54,6 @@ public class MockAssembly public static int Failures = MockTestFixture.Failures; public static int Categories = MockTestFixture.Categories; - - public static string AssemblyPath; - - static MockAssembly() - { - var assembly = typeof(MockAssembly).Assembly; - string codeBase = assembly.EscapedCodeBase; - - AssemblyPath = codeBase.ToLower().StartsWith(Uri.UriSchemeFile) - ? new Uri(codeBase).LocalPath - : assembly.Location; - } } [TestFixture(Description = "Fake Test Fixture")] diff --git a/src/tests/Program.cs b/src/tests/Program.cs new file mode 100644 index 0000000..3e3886f --- /dev/null +++ b/src/tests/Program.cs @@ -0,0 +1,19 @@ +// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt + +using System.Reflection; +using NUnitLite; + +namespace NUnit.Engine.Tests +{ + class Program + { + static int Main(string[] args) + { +#if NETFRAMEWORK + return new TextRunner(typeof(Program).Assembly).Execute(args); +#else + return new TextRunner(typeof(Program).GetTypeInfo().Assembly).Execute(args); +#endif + } + } +} diff --git a/src/tests/nunit-v2-result-writer.tests.csproj b/src/tests/nunit-v2-result-writer.tests.csproj index 00efa6d..505370b 100644 --- a/src/tests/nunit-v2-result-writer.tests.csproj +++ b/src/tests/nunit-v2-result-writer.tests.csproj @@ -4,6 +4,7 @@ net462;net6.0 + Exe Debug;Release NUnit.Engine.Tests nunit-v2-result-writer.tests @@ -16,9 +17,9 @@ - - + +