Before litmus was a test, it was a moss, or at least something people called one. The word is Old Norse litmosi, "colour moss," for the lichens that produce the dye.

Wikipedia notes that the Norse word survives in only one medieval source, a Norwegian law code of 1316 on customs duties for pelts and furs. So the word first shows up as trade goods, not science. The dye had been used since at least Viking times.

English picked it up early. The Middle English Dictionary lists lit-mose, with spellings like litemose and likemose. Its earliest dated example, from about 1320, spells it lykemose in a record of two barrels. The dictionary traces it to Old Norse and also to Middle Dutch lijkmoes. The American Heritage Dictionary agrees that two routes met: a Scandinavian word built from "dye" and "moss," and a Dutch one from "to drip" and "moss."

The science came at roughly the same time. Wikipedia credits the Catalan physician Arnaldus de Villa Nova, who died in 1311, with using litmus around 1300 to study acids and bases. He is the first person known to use it as an acidity test.

The trick is a colour change. Blue litmus turns red in acid, and red litmus turns blue in alkali. Wikipedia gives its working range as roughly pH 4.5 to 8.3. Soaked into filter paper, it became one of the oldest pH indicators. The dye still comes from lichens, with species from Mozambique and California now the main sources.

From there the word took a figurative turn. A litmus test is now a single question that settles a judgment, often about politics. Merriam-Webster defines it as a test in which one factor is decisive, and lists 1913 as its first known use. Dates for the political sense vary between dictionaries.

The moss half was never quite right. Lichens are not true mosses, but the medieval name stuck.