Skip to content

Commit

Permalink
Fix nunit#441
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanite committed Jul 22, 2018
1 parent f98bd13 commit 07f898c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/NUnitConsole/nunit3-console/ConsoleOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ public ConsoleOptions(params string[] args) : base(args) { }

public bool SkipNonTestAssemblies { get; private set; }

public bool Preload { get; private set; }

private int _maxAgents = -1;
public int MaxAgents { get { return _maxAgents; } }
public bool MaxAgentsSpecified { get { return _maxAgents >= 0; } }
Expand Down Expand Up @@ -156,6 +158,9 @@ protected override void ConfigureOptions()
this.Add("skipnontestassemblies", "Skip any non-test assemblies specified, without error.",
v => SkipNonTestAssemblies = v != null);

this.Add("preload", "Enumerate all tests before execution.",
v => Preload = v != null);

this.Add("agents=", "Specify the maximum {NUMBER} of test assembly agents to run at one time. If not specified, there is no limit.",
v => _maxAgents = RequiredInt(v, "--agents"));

Expand Down
2 changes: 2 additions & 0 deletions src/NUnitConsole/nunit3-console/ConsoleRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ private int RunTests(TestPackage package, TestFilter filter)
{
var eventHandler = new TestEventHandler(output, labels);

if (_options.Preload)
runner.Load();
result = runner.Run(eventHandler, filter);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/NUnitEngine/nunit.engine/Runners/MasterTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected bool IsPackageLoaded
public XmlNode Load()
{
LoadResult = _engineRunner.Load();
return LoadResult.Xml;
return LoadResult.IsSingle ? LoadResult.Xml : null;
}

/// <summary>
Expand Down

0 comments on commit 07f898c

Please sign in to comment.