Skip to content

Commit

Permalink
Merge pull request #1481 from nunit/issue-1467
Browse files Browse the repository at this point in the history
Update header and help to clarify which console runner is in use
  • Loading branch information
CharliePoole authored Sep 15, 2024
2 parents 5056d41 + d2cf4f7 commit 3f10f67
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 9 deletions.
50 changes: 44 additions & 6 deletions src/NUnitConsole/nunit3-console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ private static void WriteHeader()
Assembly entryAssembly = Assembly.GetEntryAssembly();
var versionBlock = FileVersionInfo.GetVersionInfo(entryAssembly.ManifestModule.FullyQualifiedName);

var header = $"{versionBlock.ProductName} {versionBlock.ProductVersion}";
var version = versionBlock.ProductVersion;
int plus = version.IndexOf('+');
if (plus > 0) version = version.Substring(0, plus);
var header = $"{versionBlock.ProductName} {version}";

#if NETFRAMEWORK
object[] configurationAttributes = entryAssembly.GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false);
Expand All @@ -185,7 +188,22 @@ private static void WriteHelpText()
OutWriter.WriteLine();
OutWriter.WriteLine(ColorStyle.Header, "NUNIT3-CONSOLE [inputfiles] [options]");
OutWriter.WriteLine();
OutWriter.WriteLine(ColorStyle.Default, "Runs a set of NUnit tests from the console.");
OutWriter.WriteLine(ColorStyle.SectionHeader, "Description:");
using (new ColorConsole(ColorStyle.Default))
{
#if NETFRAMEWORK
OutWriter.WriteLine(" The standard NUnit Console Runner runs a set of NUnit tests from the");
OutWriter.WriteLine(" console command-line. By default, all tests are run using separate agents");
OutWriter.WriteLine(" for each test assembly. This allows each assembly to run independently");
OutWriter.WriteLine(" and allows each assembly to run under the appropriate target runtime.");
#else
OutWriter.WriteLine(" The NetCore Console Runner runs a set of NUnit tests from the console");
OutWriter.WriteLine(" command-line. All tests are run in-process and therefore execute under");
OutWriter.WriteLine(" the same runtime as the runner itself. A number of options supported by");
OutWriter.WriteLine(" the standard console runner are not available using the NetCore runner.");
OutWriter.WriteLine(" See \"Limitations\" below for more information.");
#endif
}
OutWriter.WriteLine();
OutWriter.WriteLine(ColorStyle.SectionHeader, "InputFiles:");
OutWriter.WriteLine(ColorStyle.Default, " One or more assemblies or test projects of a recognized type.");
Expand All @@ -196,7 +214,7 @@ private static void WriteHelpText()
Options.WriteOptionDescriptions(Console.Out);
}
OutWriter.WriteLine();
OutWriter.WriteLine(ColorStyle.SectionHeader, "Description:");
OutWriter.WriteLine(ColorStyle.SectionHeader, "Operation:");
using (new ColorConsole(ColorStyle.Default))
{
OutWriter.WriteLine(" By default, this command runs the tests contained in the");
Expand Down Expand Up @@ -242,10 +260,30 @@ private static void WriteHelpText()
OutWriter.WriteLine(" To be able to load NUnit projects, file type .nunit, the engine");
OutWriter.WriteLine(" extension NUnitProjectLoader is required. For Visual Studio projects");
OutWriter.WriteLine(" and solutions the engine extension VSProjectLoader is required.");
#if NETCOREAPP
OutWriter.WriteLine();
//writer.WriteLine("Options that take values may use an equal sign, a colon");
//writer.WriteLine("or a space to separate the option from its value.");
//writer.WriteLine();
OutWriter.WriteLine(ColorStyle.SectionHeader, "Limitations:");
OutWriter.WriteLine(" The NetCore Runner is primarily intended for use as a dotnet tool.");
OutWriter.WriteLine(" When used in this way, a single assembly is usually being tested and");
OutWriter.WriteLine(" the assembly must be compatible with execution under the same runtime");
OutWriter.WriteLine(" as the runner itself, normally .NET 6.0.");
OutWriter.WriteLine();
OutWriter.WriteLine(" Using this runner, the following options are not available. A brief");
OutWriter.WriteLine(" rationale is given for each option excluded.");
OutWriter.WriteLine(" --configFile Config of the runner itself is used.");
OutWriter.WriteLine(" --process Not designed to run out of process.");
OutWriter.WriteLine(" --inprocess Redundant. We always run in process.");
OutWriter.WriteLine(" --domain Not applicable to .NET Core.");
OutWriter.WriteLine(" --framework Runtime of the runner is used.");
OutWriter.WriteLine(" --x86 Bitness of the runner is used.");
OutWriter.WriteLine(" --shadowcopy Not available.");
OutWriter.WriteLine(" --loaduserprofile Not avalable.");
OutWriter.WriteLine(" --agents No agents are used.");
OutWriter.WriteLine(" --debug Debug in process directly.");
OutWriter.WriteLine(" --pause Used for debugging agents.");
OutWriter.WriteLine(" --set-principal-policy Not available.");
OutWriter.WriteLine(" --debug-agent No agents are used.");
#endif
}
}

Expand Down
12 changes: 9 additions & 3 deletions src/NUnitConsole/nunit3-console/nunit3-console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup>
<Product>NUnit Console</Product>
<PropertyGroup Condition="'$(TargetFramework)'=='net462'">
<Product>NUnit Console Runner</Product>
<AssemblyTitle>NUnit Console Runner ($(TargetFramework))</AssemblyTitle>
<Description>The console command-line runner for NUnit</Description>
<Description>The standard command-line runner for NUnit</Description>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net6.0' or '$(TargetFramework)'=='net8.0'">
<Product>NUnit NetCore Console Runner</Product>
<AssemblyTitle>NUnit NetCore Console Runner ($(TargetFramework))</AssemblyTitle>
<Description>The dotnet command-line runner for NUnit</Description>
</PropertyGroup>

<PropertyGroup>
Expand Down

0 comments on commit 3f10f67

Please sign in to comment.