In the big data era, how to deal with heterogeneous observations is an inevitable and important issue. We consider testing (mean) independence in the presence of heterogeneity. To be precise, in the first part of the talk, we consider testing for the effects of high-dimensional covariates on the response. In the second part of the talk, we propose three tests to test independence between two high-dimensional random vectors based on the rank-based indices derived from Hoeffding's $D$, Blum-Kiefer-Rosenblatt's $R$ and Bergsma- Dassios-Yanagimoto's $\tau^{*}$.