Kategorien
Programming Testing

Generate Unit Tests automatically (?)

For quite a while I´m thinking about a solution for following situation:
I have a lot of (old) scripts/ classes, which I created without unit tets (yes, shame on me, but by the time I´ve written them, I didn´t knew better, or didn´t had the time to do so, … the usual excuses).
Now I would like to add unit tests afterwards, to benefit from all the advantages they give to a programmer (find regression, give a safety net, etc.).

But I´m just too lazy to go all of my code and add unit test after unit test after unit test. Instead I would like to auto-generate them. At least the skeleton, like test classes & methods; so e.g. create a test method for every method used, create a test for every object that should be (not) accesible from the outside, etc.
I know that I will have to create the test logic by myself, so checking if a method returns the expected result (or not).

Before start coding a solution, I would like to know if there´s something existing like that already? If yes, I would appreciate any hints/ links/ articles etc., especially for Ruby, but Java and/ or C# would also be great.
Thx in advance!