Testo an Italian word derives from the Latin term, textum (text), which in turn originated from the verb texĕre, which means to weave.
Treccani, the Italian online dictionary and encyclopedia par excellence says:
testo² s. m. [dal lat. textum -i o textus -us, rispettivam. part.
pass. neutro e der. di texĕre "tessere"]. [...] 2. (estens., bibl.) [edizione, spec. se
antica e autorevole: t. classici; i t. sacri] ≈ libro, opera, scritto,
Roughly translated, the word testo is used when referring to the classics i.e. classic literature, and sacred works or volumes.
The verb, testify, (In Italian testimoniare) derives from the noun, testimony, its Latin form testimonium which the OP rightly affirmed derives from testis and its plural form teste.
The testicle (from Latin testiculus, diminutive of testis, meaning
"witness" of virility, plural testes)
(pl. testes), 1704, from L. testis "testicle," usually regarded as a
special application of testis "witness" (see testament), presumably
because it "bears witness" to virility (cf. Gk. parastates, lit. "one
that stands by;" and Fr. slang témoins, lit. "witnesses").
Looking at the word teste, which means
also witness in Italian, according to Treccani it derived originally from the Latin term, tristis (sad, sorrowful, disagreeable or foul smelling) which later evolved into terstis, meaning third party.
So far I haven't find any solid evidence that suggests testament, testimony, testify, are directly related to testes/testicles. I'm more inclined to believe that the root word is textum meaning text or teste (witness), therefore the tradition of swearing an oath by placing one's hand on the Bible rather than on one's testicles, makes sense. If this needs reminding, Christians are not required to be circumcised, so there is no guarantee the judge would be circumcised. See David M's answer as to why it is relevant.
One more thing to consider, would women really have been asked to place their hands on the judge's genitals before a court of law? Back when?
From the Wikipedia article entitled Sexuality in Ancient Rome
The apparent connection between Latin testes, "testicles," and testis,
plural testes, "witness" (the origin of English "testify" and
"testimony") may lie in archaic ritual. Some ancient
Mediterranean cultures swore binding oaths upon the male genitalia,
symbolizing that "the bearing of false witness brings a curse upon not
only oneself, but one's house and future line." Latin writers
make frequent puns and jokes based on the two meanings of testis:
it took balls to become a legally functioning male citizen. The
English word "testicle" derives from the diminutive testiculum.
link 186 informs
Joshua T. Katz, "Testimonia Ritus Italicus: Male Genitalia, Solemn
Declarations, and a New Latin Sound Law," Harvard Studies in Classical
Philology 98 (1998) 183–217 (quotation from p. 193), pointing to the
oaths in the Book of Genesis, chapters 24 and 47; the testicles of
ritually slaughtered animals used to affirm testimony in Athenian
murder trials, as at Demosthenes, Contra Aristocratem 23.67f.;
Rhetorica ad Herennium 3.33, where ram's testicles are a mnemonic
device in a courtroom exercise. Katz proposes that the Umbrian hapax
urfeta means "testicles" and is related to Latin orbis (as "balls");
thus the Iguvine Tables also make a connection between testicles and
"solemn declarations" (Katz, p. 191).
I had to look up hapax because I don't think I have ever come across this word before. A hapax legomenon is a word that occurs only once within a context, either in the written record of an entire language, in the works of an author, or in a single text.
A Slate article, Where Did We Get Our Oath? debunks the urban legend, as it claims, of ancient Romans who vowed to tell the truth by grabbing hold of their testicles or as I found in one recount; of two male witnesses who would hold each other's testicles when taking an oathGames Primates Play, I'm inclined to think this version is rather fanciful and at this point we really need an expert in Ancient History.
Latin scholars have debunked this colorful claim, pointing out that
testis more likely comes from the Ancient Greek for "three"—a witness being a third observer of events.
Witness (Testimonio 1/Testimone 2/Teste 3)
Until the 16th century the Italian for witness used to be testimonio but today that has been superceded by testimone and teste. A brief history of the word, testimonianza, written in Italian, is provided by Treccani. Testimonianza in English is deposition (Law) Sworn testimony recorded for use in court at a later date.
In his book, AIDS, Bearing Witness, and the Queer Moving Image, Roger Hallas provides this clear explanation.
Consequently, it appears that the word, testify, and all its derivatives come from the Latin term, terstis (third party or person) which Treccani also confirms.