(plural testes), 1704, from Latin testis "testicle," usually regarded as a special application of testis "witness" (see testament), presumably because it "bears witness to male virility" [Barnhart]. Stories that trace the use of the Latin word to some supposed swearing-in ceremony are modern and groundless.
Compare Greek parastatai "testicles," from parastates "one that stands by;" and French slang témoins, literally "witnesses." But Buck thinks Greek parastatai "testicles" has been wrongly associated with the legal sense of parastates "supporter, defender" and suggests instead parastatai in the sense of twin "supporting pillars, props of a mast," etc. Or it might be a euphemistic use of the word in the sense "comrades." OED, meanwhile, points to Walde's suggestion of a connection between testis and testa "pot, shell, etc." (see tete).