Monday, 15 September 2014

python - Is there an open source tool that automatically generates test cases for legacy code? -



python - Is there an open source tool that automatically generates test cases for legacy code? -

i stumbled on (aged) article:

http://imranontech.com/2007/01/04/unit-testing-the-final-frontier-legacy-code/

where author allegedly wrote perl script automatically generate test cases. strategy went (cited):

read in header files gave it. extracted function prototypes. gave me list of functions found , allow me pick ones wanted create unit tests for.

it created dbx (solaris debugger) script break-point every time selected function called, save variables passed , go on until function returned @ point save homecoming value.

run executable under dbx script, , point proceeded utilize application normal, , ran through lots of utilize cases thought go through code in question , cases thought nail border cases in functions want create unit tests for.

the perl script took of illustration runs, stripped out duplicates, , autogenerated c file containing unit tests each of examples (i.e pass in input info , verify homecoming value same in illustration run) compiled/linked/ran unit tests , threw away ones failed (i.e. rid of inputs cause function behave non-deterministically)

i have lot of legacy code of kinds in languages python , fortran. article 2007. there implemented in current unit testing frameworks?

how go writing such script?

very c-like. also, os dependent, think (solaris debugger)? i'd should @ "record/capture , playback" tools, though somehow think "generate" part never took off.

python's testing tools taxonomy great place start. i'd either record way through application using selenium or dogtail. link takes right section, web testing tools, check others well: fuzzy testing technique similar golden master, may help legacy apps, , "record / playback" technique. feathers calls such tests "characterization" test, characterize legacy system's behaviours.

very point in article cite:

have @ own source code repository , see functions/classes have had bugfix checkins applied, 80% of bugfixes tend made 20% of code. there’s sound logic behind – 20% of code poorly written dozens or hundreds of “special case” hacks.

this i'd start. have got these parts identified? simple git/svb log usage scripts , coverage tools section taxonomy come in handy this.

unfortunately more can't help - python experience limited , fortran - non-existing.

python unit-testing fortran legacy-code

No comments:

Post a Comment