开发者

Can I use breakpoints (as while debugging) while 'unit testing'?

I'm walking through the FrontStore series tutorial on TDD in MVC (Part 3 by Rob Conery/ASP.NET). The test I'm concerned with is the CatalogRepository_Each_Category_Contains_5_Products(). Until I get to that test, everything was working fine. Now, I've gone through every line that makes this test (including the test itself, the TestCatalogRepository, ...). I've also compared my code to that of Rob, but the test keeps failing.

I also checked the source code from CodePlex, that test was not there.

Now, I wonder if I can put a break point somewhere to check the开发者_开发百科 local values as the test is being executed? If not, something similar?

Thanks for helping.


Debugging tests should be exactly the same as debugging your code - put a break point and run the test in debug (in MSTest ctrl+R, ctrl+T).


Depending on you testrunner (Nunit or VS) you start the test in debug mode (VS) or you start the testrunner and attach to the proces of the testrunner (nunit)


Another approach would be to create unit tests that act as breakpoints. It would require refactoring the SUT.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜