This work was part of the EU RobustMilk project. In this work package, we have focused on two aspects of robustness, micro- and macro-environmental sensitivity and applied these to somatic cell count (SCC), one aspect of milk quality. We showed that it is possible to combine both categorical and continuous descriptions of the environment in one analysis of genotype by environment interaction. We also developed a method to estimate genetic variation in residual variance and applied it to both simulated and a large field data set of dairy cattle. We showed that it is possible to estimate genetic variation in both micro- and macro-environmental sensitivity in the same data, but that there is a need for good data structure. In a dairy cattle example, this would mean at least 100 bulls with at least 100 daughters each. We also developed methods for improved genetic evaluation of SCC. We estimated genetic variance for some alternative SCC traits, both in an experimental herd data and in field data. Most of them were highly correlated with subclinical mastitis (>0.9) and clinical mastitis (0.7 to 0.8), and were also highly correlated with each other. We studied whether the fact that animals in different herds are differentially exposed to mastitis pathogens could be a reason for the low heritabilities for mastitis, but did not find strong evidence for that. We also created a new model to estimate breeding values not only for the probability of getting mastitis but also for recovering from it. In a progeny-testing situation, this approach resulted in accuracies of 0.75 and 0.4 for these two traits, respectively, which means that it is possible to also select for cows that recover more quickly if they get mastitis.