Kevin McNeish Blog

All things iOS, Kindle and .NET

Recent Posts

Tags

News

  • First books in my new book series, "iOS App Development for Non-Programmers" are now available! iBookStore: http://itunes.apple.com/us/book/book-1-diving-in-ios-app-development/id558788074?mt=11 Amazon: http://www.amazon.com/dp/B0097N8XBE Amazon: http://www.amazon.com/dp/B0099RQGMQ

Community

Email Notifications

Archives

Using NUnit in Visual Studio 2010

To use NUnit with Visual Studio 2010, follow these steps:

1. Make sure you have the latest version of NUnit installed

2. In Visual Studio, open up the nunit.exe.config file found at:

C:\Program Files\NUnit 2.x.x\bin\net-2.0\

3. Under the <configuration> element, add the following (make sure the version number is correct for your installation of VS 2010):

     <startup>

           <requiredRuntime version="v4.0.30319" />

     </startup>

4. Under the <runtime> element, add the following:

<loadFromRemoteSources enabled="true" />

Best Regards,
Kevin McNeish
INETA Speaker
Chief Software Architect, MM .NET Application Framework
www.oakleafsd.com

Comments

sonia said:

i tried this but i have issue. i mean when i run my project nothing happens but project runs normally. No unit tests are run. i checked version and its correct.

Do i need to give reference of this config file in my project?..Or i have to something else

My nunit.exe.config is as following

<?xml version="1.0" encoding="utf-8"?>

<configuration>

 <!--

  The GUI only runs under .NET 2.0 or higher. The

  useLegacyV2RuntimeActivationPolicy setting only

  applies under .NET 4.0 and permits use of mixed

  mode assemblies, which would otherwise not load

  correctly.

 -->

 <startup useLegacyV2RuntimeActivationPolicy="true">

   <!-- Comment out the next line to force use of .NET 4.0 -->

   <requiredRuntime version="v4.0.30319" />

 </startup>

 <runtime>

   <!-- Ensure that test exceptions don't crash NUnit -->

   <legacyUnhandledExceptionPolicy enabled="1"/>

   <!-- Run partial trust V2 assemblies in full trust under .NET 4.0 -->

   <loadFromRemoteSources enabled="true"/>

   <!-- Look for addins in the addins directory for now -->

   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

     <probing privatePath="lib;addins"/>

   </assemblyBinding>

 </runtime>

</configuration>

# February 21, 2013 5:38 AM

KevinMcNeish said:

You should create a separate project that contains your unit tests, and make that the startup project in your solution.

Kevin

# February 21, 2013 1:24 PM
Leave a Comment

(required) 

(required) 

(optional)
 

(required) 

If you can't read this number refresh your screen
Enter the numbers above: