Refactor runtest test_defs to allow programmatic creation.

Previously a test definition could only be created via xml.
Also fix some minor lint warnings.
7 files changed