Re: Running Tests as [STAThread]

"Charlie Poole" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.devel
Message-ID <008101c87af4$e40cc470$6401a8c0@ferrari>
Of course, running individual tests in a STA would call for running them on
a separate thread.
 
There's an item for this in the 2.5 roadmap - http://nunit.org/?p=roadmap.
 
A console option is a possibility, but would apply to the whole run. I favor
putting this
right in the tests as an attribute, since the need to use the STA is
generally 
a characteristic of the test, not just an accident of how we are running it.
 
Charlie



  _____  

From: Kishore v [mailto:[email protected]] 
Sent: Thursday, February 28, 2008 10:25 PM
To: Charlie Poole
Cc: [email protected]
Subject: Re: [nunit-developer] Running Tests as [STAThread]


Yes, It can be done. However, I wan't to know there is any easier way.
  <NUnit>
    <TestRunner>
        <add key="ApartmentState" value="STA" />
    </TestRunner>
  </NUnit>

Also, I do not want an STA for every test in the test suite, only for a few
instances of tests.
But I can't refactor these tests because the objective is to run the tests
'as' they are given.

Also, Is it possible to have a command-line equivalent?
like, nunit-console.exe /apartmentstate=STA /fixture=STR? I know this will
be similar to changing the config, but its more easier this way.


On Fri, Feb 29, 2008 at 10:53 AM, Charlie Poole <[email protected]>
wrote:


You specify the apartment model in the test config file. See the config for
NUnit's own tests for an example.
 
Charlie


  _____  

From: [email protected]
[mailto:[email protected]] On Behalf Of Kishore
v
Sent: Thursday, February 28, 2008 7:13 PM
To: [email protected]
Subject: [nunit-developer] Running Tests as [STAThread]


Hello,

I have tests written in a different in-house framework for which I have also
created an addin to run these from NUnit.
The tests are picked up from the test assembly and are running fine from
NUnit.
The problem is I've some GUI tests which always need to run with a
[STAThread] attribute. These tests always fail if the threading apartment is
not set to STA.
Previously I've had the luxury to set the entry point (the main thread of
the application which calls these tests) with the STA or MTA attributes as
required.
Is there some way I can configure NUnit to provide me the same results as my
previous test harness?

Regards,
Kishore



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
nunit-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-developer






-- 
Absurdum est ut alios regat, qui seipsum regere nescit.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
nunit-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-developer
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.