When Google posted a blog post on approved A/B testing methods, they specifically said do not use user-agents when determining what to A/B test. Google wrote, “make sure that you’re not deciding whether to serve the test, or which content variant to serve, based on user-agent.”
So when someone in the Google Webmaster Help forums had a valid reason to do so, John Mueller from Google explained why it may be okay in his case.
In short, he wants to test conversions between an m-dot and responsive design for iPad users only. He wants to see if the conversions will drop or increase but is worried if he does user-agent target for iPad users, it may be against Google’s guidelines.
John Mueller said it should be okay but added some caveats, which I will quote right there:
So be careful when doing A/B testing and the best bet, do it for a short period of time.
Forum discussion at Google Webmaster Help.