The local robustness properties of generalized method of moments (GMM) estimators and of a broad class of GMM based tests are investigated in a unified framework. GMM statistics are shown to have bounded influence if and only if the function defining the orthogonality restrictions imposed on the underlying model is bounded. Since in many applications this function is unbounded, it is useful to have procedures that modify the starting orthogonality conditions in order to obtain a robust version of a GMM estimator or test. We show how this can be obtained when a reference model for the data distribution can be assumed. We develop a flexible algorithm for constructing a robust GMM (RGMM) estimator leading to stable GMM test statistics. The amount of robustness can be controlled by an appropriate tuning constant. We relate by an explicit formula the choice of this constant to the maximal admissible bias on the level or (and) the power of a GMM test and the amount of contamination that one can reasonably assume given some information on the data. Finally, we illustrate the RGMM methodology with some simulations of an application to RGMM testing for conditional heteroscedasticity in a simple linear autoregressive model. In this example we find a significant instability of the size and the power of a classical GMM testing procedure under a non-normal conditional error distribution. On the other side, the RGMM testing procedures can control the size and the power of the test under non-standard conditions while maintaining a satisfactory power under an approximatively normal conditional error distribution.