Skip to content

Commit 3f1f03c

Browse files
committed
Merge pull request #147 from stylpe/master
Add options to NUnit task: /process, /domain and /apartment. Resolves #117
2 parents 59283f0 + a10bff9 commit 3f1f03c

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

Diff for: Source/MSBuild.Community.Tasks/NUnit.cs

+49
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,49 @@ public bool ShowLabels
261261
set { _showLabels = value; }
262262
}
263263

264+
private string _process;
265+
266+
/// <summary>
267+
/// The /process option controls how NUnit loads tests in processes. The following values are recognized.
268+
/// Single - All the tests are run in the nunit-console process. This is the default.
269+
/// Separate - A separate process is created to run the tests.
270+
/// Multiple - A separate process is created for each test assembly, whether specified on the command line or listed in an NUnit project file.
271+
/// Note: This option is not available using the .NET 1.1 build of nunit-console.
272+
/// </summary>
273+
public string Process
274+
{
275+
get { return _process; }
276+
set { _process = value; }
277+
}
278+
279+
private string _domain;
280+
281+
/// <summary>
282+
/// The /domain option controls of the creation of AppDomains for running tests. The following values are recognized:
283+
/// None - No domain is created - the tests are run in the primary domain. This normally requires copying the NUnit assemblies into the same directory as your tests.
284+
/// Single - A test domain is created - this is how NUnit worked prior to version 2.4
285+
/// Multiple - A separate test domain is created for each assembly
286+
/// The default is to use multiple domains if multiple assemblies are listed on the command line. Otherwise a single domain is used.
287+
/// </summary>
288+
public string Domain
289+
{
290+
get { return _domain; }
291+
set { _domain = value; }
292+
}
293+
294+
private string _apartment;
295+
296+
/// <summary>
297+
/// The /apartment option may be used to specify the ApartmentState (STA or MTA) of the test runner thread. Since the default is MTA, the option is only needed to force execution in the Single Threaded Apartment.
298+
/// Note: If a given test must always run in a particular apartment, as is the case with many Gui tests, you should use an attribute on the test rather than specifying this option at the command line.
299+
/// </summary>
300+
public string Apartment
301+
{
302+
get { return _apartment; }
303+
set { _apartment = value; }
304+
}
305+
306+
264307
#endregion
265308

266309
#region Task Overrides
@@ -309,6 +352,12 @@ protected override string GenerateCommandLineCommands()
309352

310353
builder.AppendSwitchIfNotNull(c+"framework=",_framework);
311354

355+
builder.AppendSwitchIfNotNull(c+"process=",_process);
356+
357+
builder.AppendSwitchIfNotNull(c+"domain=",_domain);
358+
359+
builder.AppendSwitchIfNotNull(c+"apartment=",_apartment);
360+
312361
return builder.ToString();
313362
}
314363

0 commit comments

Comments
 (0)