Tollens' test works by reacting a sample of the unknown compound with Tollens' reagent, which is a solution of silver nitrate and sodium hydroxide. If the sample contains an aldehyde, it will react with the silver ions in the reagent to form a silver metal, which will form a characteristic silver mirror on the inner surface of the test tube.