Running WatiN tests in SharpDevelop

I tried to run my WatiN tests in the test runner in SharpDevelop and got stuck on the following error:

System.Threading.ThreadStateException : The CurrentThread needs to have it's ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer.

If you are running your tests with MBUnit you can add the following to your TestFixture:

[TestFixture(ApartmentState = ApartmentState.STA)]

But I couldn’t find any similar for NUnit. Instead I changed how SharpDevelop launches it’s tests. Click; Tools / Options / Tools / Unit Tests and deselect Run tests on separate thread. Run the tests again.

And I got the following error:

System.InvalidOperationException : Process has exited, so the requested information is not available.

I tried to disable Protected Mode in Internet Explorer and the tests ran fine.

How to dissable Protected Mode in IE
How to disable Protected Mode in IE

Publicerat av

Ola

Mångsysslande doer & klätterentusiast. Jag driver varumärket Sten & bloggen Klätterbilder. Jag konsultar inom IT & Marknadsföring samt undervisar inom webb på Folkuniversitetet. Jag älskar att fota. /// Doer & climbing enthusiast. I run the climbing brand Sten & the blog Klätterbilder. Consulting with IT & marketing & teaching at Folkuniversitetet. I love to take pictures.