A flame test is relatively quick test for the presence of some elements in a sample.  The technique is archaic and of questionable reliability, but once was a component of qualitative inorganic analysis. The phenomenon is related to pyrotechnics and atomic emission spectroscopy.  The color of the flames is understood through the principles of atomic electron transition and photoemission, where varying elements require distinct energy levels (photons) for electron transitions.