fix #381 improve TemplateTestCase::nextTest()

Close #382.