The conceptional design of the proposed linear electron-positron collider TESLA is based on 9-cell 1.3 GHz superconducting niobium cavities with an accelerating gradient of E acc $ 25 MV͞m at a quality factor Q 0 $ 5 3 10 9 . The design goal for the cavities of the TESLA Test Facility (TTF) linac was set to the more moderate value of E acc $ 15 MV͞m. In a first series of 27 industrially produced TTF cavities the average gradient at Q 0 5 3 10 9 was measured to be 20.1 6 6.2 MV͞m, excluding a few cavities suffering from serious fabrication or material defects. In the second production of 24 TTF cavities, additional quality control measures were introduced, in particular, an eddy-current scan to eliminate niobium sheets with foreign material inclusions and stringent prescriptions for carrying out the electronbeam welds. The average gradient of these cavities at Q 0 5 3 10 9 amounts to 25.0 6 3.2 MV͞m with the exception of one cavity suffering from a weld defect. Hence only a moderate improvement in production and preparation techniques will be needed to meet the ambitious TESLA goal with an adequate safety margin. In this paper we present a detailed description of the design, fabrication, and preparation of the TESLA Test Facility cavities and their associated components and report on cavity performance in test cryostats and with electron beam in the TTF linac. The ongoing research and development towards higher gradients is briefly addressed.