This paper addresses the problem of the self-scheduling of thermal generating units during commissioning. A 0/1 mixed-integer linear formulation is presented, which allows an accurate and realistic modeling for the scheduling of the commissioning tests that should be performed once the construction of the thermal unit has been completed and prior to entering its commercial operation. A flexible contract between the producer and the contractor regarding the performing period of the commissioning tests is proposed. The model presented can be used by a producer with thermal units in commissioning, who acts either as a price-taker or a price-maker in the day-ahead energy market. Test results on a medium-scale real test system address the effect that the implementation of the proposed model has on the producer profits as well as on the day-ahead market clearing prices.