开发者

Using Pex and Moles for kind of non-PUT testing

I want to test some code that isn't written with regards to TDD or a开发者_开发问答ny other form of automated testing, using .NET 4.

The integrated Unit Testing in VS2010 isn't enough for my goals, so I've looked at Pex & Moles.

What I have is a code that is used to represent video files on a remote device. Access to the device is handled via a specific SDK, and a wrapper is written for that SDK. Using Moles, I can override the wrapper functions and substitute them with functions that read data from local file. I do that using Moles and integrated unit testing. However, it's not enough, as I can only imitate "always working" device that way, while in reality, they do often fail.

I've thought about adding PexChoose into bodies of fake methods, so that they either work as they should or fail, so that Pex would build a tree of possible combinations of various methods' execution outcomes.

However, If I try to create a Pex test from existing code, removing all parameters from the test( I don't need them, everything gets arranged inside), add the mock methods and try to run Pex Explorations, it results in "path bounds exceeded" message. I have tried setting very high bounds, but it didn't help. What can I do to solve this?

I'm very new to Moles, Pex, and unit testing in general, so I may be conceptually wrong. Thanks in advance.


If you are attempting to test how your application responds to a failure that occurs within the SDK (due to disk or whatever), there isn't anything stopping you from throwing exceptions in your delegates.


Works for me. Here are the pex exploration results: http://xmages.net/storage/10/1/0/c/e/upload/c6c9ced6.png

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜