3

We have a large body of legacy code, several portions of which are scheduled for refactoring or replacement. We wish to optimise parts that currently impact on the user-experience, facilitate reuse in a new product being planned, and hopefully improve maintainability too.

We have quite good/comprehensive functional tests for an existing product. These are a mixture of automated and manually-driven GUI tests, but they can take a developer more than half a day to run fully. The "low-level domain logic" has a good suite of unit tests (NUnit) with good coverage. Unfortunately, the remainder of the code has no unit tests (or, at least, no worthy unit tests).

What I'd like to find is a tool that automatically generates unit tests for specific methods/classes and maybe specific interfaces based on their use and behaviour in the functional tests. These unit tests would be invaluable for refactoring, and would also be run as part of our C.I. system to detect regressions much earlier than is currently happening (and to localise regressions much better than "button X doesn't work.").

Do any such tools exist? Do you have any recommendations for me?

I've come across Parasoft .TEST, which looks like it might do want I want. Do you have any comments on that, with respect to my situation?

I don't think something that just generates test code from a static analysis, ala NStub, is useful here. I suppose it is actually the generation of representative test data that is really important.

Please ignore the merits, or lack of, of automated test generation - it is not something I'd usually advocate. (Not least because you get tests that pass for broken code!)

4

2 回答 2

2

尝试Pex

直接从 Visual Studio 代码编辑器中,Pex 找到您的方法的有趣输入输出值,您可以将其保存为具有高代码覆盖率的小型测试套件。Pex 执行系统分析,寻找边界条件、异常和断言失败,您可以立即对其进行调试。Pex 支持参数化单元测试,这是单元测试的扩展,可降低测试维护成本。

于 2009-05-06T08:55:16.757 回答
0

Well, you could look at PEX - but I believe that invents its own data (it doesn't watch your existing tests, AFAIK).

于 2009-05-06T08:54:41.830 回答