A last will and testament was commonly understood as a legal document through which a person designated the transfer of rights over property, familial custody, and the like after death. It was also often seen as a means to give an accounting of their thoughts, concerning their life in general, their anticipated death, and the intent of their bequeathing particular things to certain people or organizations.
When someone who recorded a regular log believed that death was imminent, he or she could record a final log entry that, among other things, may have provided instructions similar to a will. (DS9: "The Ascent") Alternatively, a Starfleet command-level officer, such as a starship captain, may have left behind final orders to be implemented upon their death. (TOS: "The Tholian Web") Finally, a person could simply record a farewell message, containing no instructions, either in advance of a potentially dangerous mission or when near death. (TNG: "Skin of Evil"; VOY: "Once Upon a Time"; ENT: "Shuttlepod One")
In 2256, the last will and testament of Philippa Georgiou contained a message for Michael Burnham. It also provided for Georgiou's telescope to be inherited by Burnham. (DIS: "The Butcher's Knife Cares Not for the Lamb's Cry")
In 2374, Quark, Rom, Nog, Gaila, Leck, and Brunt offered to trade a Vorta prisoner, Keevan, to the Dominion in return for Quark's mother, Ishka, who had been taken prisoner. In an effort to dissuade them from going through with the trade, Keevan warned the six Ferengi that they should get their wills in order, as the Jem'Hadar would likely kill them all on sight. (DS9: "The Magnificent Ferengi")
Later that year, a Lurian named Morn was presumed killed in an ion storm. After his funeral, Captain Sisko unsealed his will. The document directed that his entire estate be given to Quark, the bartender on the station. Quark was disappointed that the bulk of Morn's assets consisted of a shipment of spoiled Livanian beets, a "hot tub" of mud, and a painting of a matador. He soon learned that Morn had won one thousand bars of gold-pressed latinum in the Lissepian Lottery. This entangled Quark in a fight over the winnings with various individuals. It was revealed that Morn and these individuals had actually stolen the latinum in the infamous Lissepian Mother's Day Heist. After Quark arranged a sting to have the criminals caught by Odo, he was surprised to find Morn alive and well, having faked his death to shake off the other thieves. Though the will was then void, Morn nonetheless gave a portion of the latinum, which he had stored in his second stomach, to Quark out of gratitude. (DS9: "Who Mourns for Morn?")
In 2377, Dr. Lewis Zimmerman, a scientist in holographic research aboard Jupiter Station, began recording a last will and testament as he believed himself to be in the end stages of a terminal illness. He designated that Reginald Barclay be given his collection of holographic art, including the piece "Woman in Four Dimensions", as he appreciated it more than others had. In addition, he wanted the Trojan Horse Project to be subsequently directed by Barclay as he trusted him to complete it. Regarding his holographic assistant Haley, he requested that Starfleet keep her program running for as long as Jupiter Station existed. Further dispositions were interrupted by the physical effects of his condition. Zimmerman later recovered and his imminent death was averted. (VOY: "Life Line")