Is there a framework that supports UnitTesting of WPF applications. It should not be to difficult to establishe, because I don't want that writing the tests takes ten times longer than implementing a small feature.
问题:
回答1:
You can try with NUnit, just like you'll do with any other component.
Optionally you can try MVC.
See CodeProject for MVCtoUnitTestinWPF
Hope it serves.
回答2:
You can try IcuTest. It simplifies WPF unit testing a lot.
回答3:
1) test projects within visual studio can be used to unit test WPF applications, just like they can be used to test windows forms, asp.net and asp.net mvc applications, services, etc etc.
2) Testing takes time. Sometimes it takes ten times longer to test a piece of code than it did to write it. There's no TDD fairy.
回答4:
The open source verification utility ApprovalTests (www.approvaltests.com or nuget ) will easily test Wpf views.
You can see it in action here: http://www.youtube.com/watch?v=Xc_ty03lZ9U
I'd recommend watching the winforms video 1st though, as it goes into more of the theory of how to test views in general: http://www.youtube.com/watch?v=hKeKBjoSfJ8
The code itself will look like
WpfApprovals.Verify(yourWpfView);
and it will take a screenshot and compare it agains a golden master.
回答5:
I am not really sure about WPF unit testing, but for Silverlight there is you have SilverUnit and Microsoft Silverlight Unit Test.
回答6:
I heard that White is good - though I haven't tested it myself yet..