Visual Studio Unit Testing of Windows Forms

后端 未结 8 2100
既然无缘
既然无缘 2020-12-28 09:09

We\'re working on a project here in Visual Studio 2008. We\'re using the built-in testing suite provided with it (the Microsoft.VisualStudio.TestTools.UnitTesting namespace

8条回答
  •  南笙
    南笙 (楼主)
    2020-12-28 09:47

    You would need to refactor the UI so that UI does not need any unit testing. UI should contain minimum or no business logic. There are many patterns that deal with this issue. Martin Fowler has a very good article that explains a lot about these patterns: http://martinfowler.com/eaaDev/uiArchs.html

    There is a small chapter in the Refactoring book by Martin Fowler that talks about refactoring the non testable UI. You could also read Working Effectively With Legacy Code.

    Note: There are tool that could be used to automate the UI testing. SilkTest comes to my mind. But I would not use them if possible.

提交回复
热议问题