We consider the problem of detecting unobserved heterogeneity, that is, the problem of testing the absence of random individual effects in an n × T panel. We establish a local asymptotic normality property–with respect to intercept, regression coefficient, the scale parameter σ of the error, and the scale parameter σu of individual effects (which is the parameter of interest)–for given (scaled) density f1 of the error terms, when n tends to infinity and T is fixed. This result allows, via the Hájek representation theorem, for developing asymptotically optimal rank-based tests for the null hypothesis σu = 0 (absence of individual effects). These tests are locally asymptotically optimal at correctly specified innovation densities f1, but remain valid irrespective of the actual underlying density. The limiting distribution of our test statistics is obtained both under the null and under sequences of contiguous alternatives. A local asymptotic linearity property is established in order to control for the effect of substituting estimators for nuisance parameters. The asymptotic relative efficiencies of the proposed procedures with respect to the corresponding pseudo-Gaussian parametric tests are derived. In particular, the van der Waerden version of our rank-based tests uniformly dominates, from the point of view of Pitman efficiency, the classical Honda test. Small-sample performances are investigated via a Monte-Carlo study, and confirm theoretical findings.