def METHOD_NAME(name, error_type, error):
    el = create_testcase(name)
    # encapsulate in CDATA section
    error_text = root.createCDATASection("\n%s\n" % error)
    failure_el = root.createElement("failure")
    failure_el.setAttribute("type", error_type)
    el.appendChild(failure_el)
    el.lastChild.appendChild(error_text)
    return el