The device (100) has a laser (1) formed such that laser frequency is periodically varied within a defined spectral range. The frequency is selected in such a manner that infrared absorption line to be measured of sample gas lies in the spectral range. A detector (61) e.g. mercury cadmium telluride detector, detects light, which is radiated by a measuring chamber (2) and is emitted by the laser. Light absorption within the spectral range is determined in a frequency-solved manner. The detector performs absorption measurement within the spectral range of 10 power minus five in a fast manner. An independent claim is also included for a method for testing sample gases by an infrared absorption spectroscopy.