In NUnit/Nunitlite 3.13 ( or any other version of NUnit), is it possible to force the tests to run in main thread?
I've already decorated my test as Apartment(ApartmentState.STA), and yet, it still runs in a separate thread, as shown below:
Here's my code:
[TestFixture, Apartment(ApartmentState.STA)]
public class MetaClass
{
[Test]
public void RunA()
{
Assert.AreEqual(1,1);
}
}
[Apartment(ApartmentState.STA)]
internal class Program
{
static void Main(string[] args)
{
string directoryPlugin = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string directoryReportUnit = Path.Combine(directoryPlugin, @"ReportUnit");
Directory.CreateDirectory(directoryReportUnit);
string fileInputXML = Path.Combine(directoryReportUnit, @"Report-NUnit.xml");
string[] nunitArgs = new List<string>
{
"--trace=verbose" // Tell me everything
,"--result=" + fileInputXML
,"--workers=-1" //with or without this parameter, a parallel worker thread is still used
}.ToArray();
new AutoRun().Execute(nunitArgs);
}
}
Note that with or without the parameter "--workers=-1", a parallel worker thread is still used.
