"Testimonial" is one of a range of words that go back to the Latin testis, or "witness" (from the Indo-European tris-, or three - i.e. a third person who witnesses an agreement between two others). From here we reach (via "testicle", which "bears witness" to the owner's virility), "testimonial", in which witness is borne to the subject's good qualities.
In 1838, Lord Cockburn wrote, "The growth of the modern things called testimonials is very curious. It has come of late to denote a sort of homage," while in 1851, "Bat" in Cricketer's Man reported a Kent v England testimonial for a player called Mynn.