Existing goodness-of-fit tests for survival data are either exclusively graphical in nature or only test specific model assumptions, such as the proportional hazards assumption. We describe a flexible, parameter-free goodness-of-fit test that provides a simple numerical assessment of a model's suitability regardless of the structure of the underlying model. Intuitively, the goodness-of-fit test utilizes the fact that for a good model early event occurrence is predicted to be just as likely as late event occurrence, whereas a bad model has a bias towards early or late events. Formally, the goodness-of-fit test is based on a novel generalized Martingale residual which we call the martingale survival residual. The martingale survival residual has a uniform probability density function defined on the interval -0.5 to +0.5 if censoring is either absent or accounted for as one outcome in a competing hazards framework. For a good model, the set of calculated residuals is statistically indistinguishable from the uniform distribution, which is tested using the Kolmogorov-Smirnov statistic.