refactor templates

add unit and functional test frameworks