Prisoner ZERO
Prisoner ZERO

Reputation: 14166

Do tools that pre-write UnitTests for your .NET classes exist?

My boss is asking us to research whether any tools exist that do most of the coding for you. I already know you can create a unit test by right-clicking the class in Visual Studio, and have offered this up as a solution to my bosses question. But he wants something that writes the internals FOR YOU.

Does such a tool exist?

Upvotes: 1

Views: 95

Answers (4)

bcarlso
bcarlso

Reputation: 2345

I think your boss is working under the assumption that keyboard time is the constraint in software development. The process of organizing your thoughts around how to solve the problem at hand is generally much more of a constraint than the coding itself. Generating the test may well speed up the coding but will have a minimal overall impact to throughput.

What you will find is that if you're using a modern IDE with statically typed languages (Eclipse, IntelliJ for Java, or Visual Studio + ReSharper for .NET) there are refactorings such as "Assign object to local variable" that, once committed to memory, write 75% of the code for you anyway.

As for the constraint of thinking and problem solving, I have found that TDD helps me to break the thought process for implementation of a class into such small and focused steps that the work flows more smoothly, along with the help of the IDE doing much of the coding for you is much more productive in the long term.

Upvotes: 1

TrueWill
TrueWill

Reputation: 25523

Your boss might want to consider SpecFlow. This tool lets you define acceptance tests in natural language (more or less) and then generates unit tests*.

Developers do have to write some code to precisely define the domain-specific language, of course.

*-Actually acceptance tests using existing unit test frameworks, to be technically correct.

Upvotes: 0

zoul
zoul

Reputation: 104065

I can see your boss’s motivation, but that’s simply a nonsense, isn’t it? The tests are kind of a formal specification, how could a computer write that for you?

Upvotes: 1

Related Questions