Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test Windows Forms logic with NUnit

I'm diving into unit testing and I would like to know if it is possible to test some special functionality of a dialog or a form with NUnit. I have tried NUnitForms, but it lacks good documentation and seems that nobody is mantaining that project. Is it true?

If you have any experience testing Windows Forms, please point me in the right way. Any comments or information are appreciated. Thank you!

like image 491
yeyeyerman Avatar asked Feb 04 '10 09:02

yeyeyerman


People also ask

Can NUnit be used for integration testing?

NUnit is the standard unit test framework for . NET applications. This section describes how to run NUnit tests in TestComplete.

Which is better NUnit or MSTest?

The main difference is the ability of MsTest to execute in parallel at the method level. Also, the tight integration of MsTest with Visual Studio provides advantages in both speed and robustness when compared to NUnit. As a result, I recommend MsTest.

Can NUnit be used for test driven development?

NUnit is a developing, open-source framework designed for writing and running tests in Microsoft . NET programming languages. NUnit, like JUnit, is a part of test-driven development (TDD), which is a piece of a bigger programming design paradigm known as Extreme Programming (in XP).


1 Answers

I am having the same problem with NUnitForms. I can launch a form and click a button, but I can't figure out how to get dialogs working, and I can't find much about it at all. I think this blog was the most useful: http://blogs.msdn.com/john_daddamio/archive/2006/11/06/getting-started-with-nunitforms.aspx

I had to remap the NUnitForms assembly in my app.config to get it to work with the latest version like this:

<configuration>
   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
      <dependentAssembly>
        <assemblyIdentity name="nunit.framework"
          publicKeyToken="96d09a1eb7f44a77"
          culture="neutral" />
        <bindingRedirect oldVersion="2.2.7.0" newVersion="2.5.2.9222" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

( http://duncanjasmith.blogspot.com/2007/08/using-nunitforms-with-nunit-framework.html )

I'm hoping this thread will help me, but I might still try project white ( http://www.codeplex.com/white ).

like image 92
Colin Avatar answered Oct 02 '22 17:10

Colin