TDD / Windows Application Testing Module?

I am very new to testing of any type, but I did a little reading, and it seems to me that this is a great way. I like the idea of ​​just clicking a button and making sure the code base is stable. The freedom to crack while being tested is very intriguing.

However, my software is a Windows based program. Basically, what he does is interacting with other windows on the users desktop and moving them around the screen based on certain criteria. If image XX is visible, move this window to the x / y coordinates. If the F9 key combination is pressed in this window, move it to the x2 / y2 coordinates. Etc.

I do not understand how I will conduct any checks. Any help is appreciated.

+5
source share
3 answers

Since you mentioned that you are new, I will add a reminder here that you need to be careful with what you are testing. You want to test your logic, not windows. To do this, you need to separate your problems into a class (or classes) that contain your logic, and classes that contain wrappers (proxies) for the APIs you use - you do not check the API. They work until you prove otherwise.

, . , , , Windows API , , WindowsProxy, , , .

.NET Windows-Forms - , , , MVP. , Presenter, ( ) ( API , ).

:

public interface IView { ... }

public class View : IView
{
   private Presenter _p;
   View()
   {
      _p = new Presenter(this);
      ...
   }

}

public class Presenter
{
   presenter IView _v;
   Presenter(IView view)
   {
      _v = view;
   }
}

, ​​ Moq, ( ). Moq , (, ).

, . Win-Form TDD. , .

, .

.

+4

UnitTest, Model-View-Controller ( ) Controller Model.

+2

, , , .

:

F9 , x2/y2

, / . , . , x2/y2, .

There are a lot of these tests. Of course, there is always a chance that when the window thinks, and where it actually appears, may not coincide. Therefore, you should still do some testing when you press the buttons and look at the screen. You just don't have to do all your tests.

+1
source

All Articles