Test writing is executed while skipping areas where deviations are present on an optical disk to thereby improve accuracy and reliability of an optimum recording condition to be derived. A deviation detecting unit detects the deviations of a guide groove on the optical disk on the basis of a fluctuation amount of a focus error signal or a tracking error signal, and registers information of the detected deviations onto a memory. A test writing processing unit refers to the memory, and records and reproduces a test signal while skipping the areas where the deviations are detected.