Skip to content

Commit 6e39046

Browse files
Expose more NUnitConsole arguments in NUnit3 for testing and tuning (#41)
* Expose more NUnitConsole arguments for testing and tuning * Also add instructions for packing the project for local testing +semver:minor
1 parent 7c13880 commit 6e39046

4 files changed

Lines changed: 68 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1616

1717
## [Unreleased]
1818

19+
## [2.4.0] - 2021-01-22
20+
21+
### Added
22+
23+
- [SIL.BuildTasks] `Nunit3` task: Add `Process`, `Workers`, `Trace`, `Test`, `Agents`, and `Debug` properties for passing
24+
on to the NUnit console runner for tuning and debugging
25+
26+
- ReadMe.md Added windows instructions for building a package for local testing
27+
1928
## [2.3.4] - 2020-10-05
2029

2130
### Fixed
@@ -126,4 +135,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
126135

127136
### Added
128137

129-
- First release as NuGet package
138+
- First release as NuGet package

Documentation/SIL.BuildTasks.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,27 @@ Runs NUnit3 on a test assembly.
161161

162162
See properties for NUnit task. The following additional properties are defined:
163163

164-
- `UseNUnit3Xml`: Whether to use the NUnit3 or NUnit2 XML format
165-
166164
- `NoColor`: Determines the use of colors in the output
167165

166+
- `UseNUnit3Xml`: Whether to use the NUnit3 or NUnit2 XML format
167+
168168
- `TeamCity`: Should be set to true if the tests are running on a TeamCity server.
169169
Adds `--teamcity` when calling nunit which _"Turns on use of TeamCity service messages."_
170170

171+
- `Agent`: The number of NUnit agents to use when running the tests
172+
173+
- `Workers`: Specify the NUMBER of worker threads to be used in running tests
174+
175+
- `Process`: PROCESS isolation for test assemblies. Values: Single, Separate, Multiple
176+
177+
- `DisposeRunners`: When true Dispose each test runner after it has finished running its tests
178+
179+
- `Debug`: Causes NUnit to break into the debugger immediately before it executes your tests
180+
181+
- `Test`: Comma-separated list of FULLNAMES of tests to run or explore. This option may be repeated
182+
183+
- `Trace`: Set internal trace LEVEL. Values: Off, Error, Warning, Info, Verbose (Debug)
184+
171185
### Example
172186

173187
See NUnit task.

Readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ Run tests:
4444
```bash
4545
msbuild build/SIL.BuildTasks.proj
4646
```
47+
48+
### Building a local package of SIL.BuildTasks for testing (Windows)
49+
50+
1. Run the Pack build command from inside Visual Studio on the SIL.ReleaseTasks.Dogfood project
51+
2. Run the Pack build command from inside Visual Studio on the SIL.BuildTasks project
52+
3. Install the package from the output folder into your local Nuget source e.g.`nuget.exe add output/Debug/SIL.BuildTasks.2.3.5-beta.1.nupkg -Source /c/Repositories/DevelopmentPackages/`

SIL.BuildTasks/UnitTestTasks/NUnit3.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,28 @@ public bool TeamCity
5151
}
5252
}
5353

54+
public string Test { get; set; }
55+
56+
public string Trace { get; set; }
57+
58+
public int Agents { get; set; }
59+
60+
public int Workers { get; set; }
61+
62+
public bool DisposeRunners { get; set; }
63+
64+
/// <summary>
65+
/// When set to true it will offer the opportunity to attach a debugger before starting the unit tests
66+
/// </summary>
67+
public bool Debug { get; set; }
68+
69+
/// <summary>
70+
/// PROCESS isolation for test assemblies. Values: Single, Separate, Multiple.
71+
/// If not specified, defaults to Separate for a single assembly or Multiple for more than one.
72+
/// By default, processes are run in parallel
73+
/// </summary>
74+
public string Process { get; set; }
75+
5476
/// <inheritdoc />
5577
/// <summary>
5678
/// Gets the name (without path) of the NUnit executable. When running on Mono this is
@@ -77,6 +99,20 @@ protected override string AddAdditionalProgramArguments()
7799
bldr.Append(" --x86");
78100
if (TeamCity)
79101
bldr.Append(" --teamcity");
102+
if (!string.IsNullOrEmpty(Trace))
103+
bldr.AppendFormat(" --trace={0}", Trace);
104+
if (!string.IsNullOrEmpty(Test))
105+
bldr.AppendFormat(" --test={0}", Test);
106+
if (DisposeRunners)
107+
bldr.Append(" --dispose-runners");
108+
if (Debug)
109+
bldr.Append(" --debug");
110+
if (!string.IsNullOrEmpty(Process))
111+
bldr.AppendFormat(" --process={0}", Process);
112+
if (Workers > 0)
113+
bldr.AppendFormat(" --workers={0}", Workers);
114+
if (Agents > 0)
115+
bldr.AppendFormat(" --agents={0}", Agents);
80116
return bldr.ToString();
81117
}
82118

0 commit comments

Comments
 (0)