What tools exist to automatically generate test scripts (or test script templates) from a formal specification or a program's source code?
EDIT:
The background of this question is, that I’m occasionally confronted with legacy web applications as both, a developer and a QA person. The applications are written in either Java or a combination of Java and PL/SQL, and need to be maintained (maybe sometimes rather partially refactored in the sense of re-architectured and rewritten) and amended with new features. Usually there hasn’t been any test driven development, though unit tests were added later on, which test some important spots of the code and are run during nightly builds.
Once in a while I get rotated out of one of those projects to face the next, depending on workload, schedules, business opportunities etc.
I’m looking for enhancements of my testing toolset, to both being able to quickly fill testing gaps for those kind of applications and to improve the long term stewardship (rewriting/migration support).
Test scripts would be the executable test, which can aggregated to test suites, test script templates would be the test scripts with placeholders for test data, which get replaced somehow to make them complete test scripts (either preprocessed or during execution).
Since those are applications that already are live, you indeed would be able to record the outcome of the tests as is and store it as expected result for a given typical input.
I also found a web source that talks about the extraction of models from source code http://drops.dagstuhl.de/opus/volltexte/2007/881/, so maybe it would be possible to put a model on top? And generate test scripts from that model?
I would like to know, if somebody used a tool following the ideas described above, and how it turned out.