added addOnPreRun and addOnPostRun
Merge pull request #1452 from inolen/onprerun

added addOnPreRun and addOnPostRun