We present a statistical test for the hypothesis of (approximate) utility maximization on the basis of nonparametric revealed preference conditions. We take as null hypothesis that the consumer behaves randomly, and we reject this hypothesis only if the data provides sufficient evidence to support the alternative hypothesis of approximate utility maximization. Our statistical test uses a permutation method to operationalize the principle of random consumption behavior. We show that our test (i) is valid for any sample size under the null and (ii) has an asymptotic power of one. We also provide simulated power results and two empirical applications.