The quality of captured wild pets is random. As of patch 5.1, upon entering a battle the Pet Battle UI shows the quality of a wild pet (idicated by a color-coded border around its icon). If you're farming a specific quality, if you forfeit the match your team will incur a small damage penalty (roughly 10%). There is no accurate way to determine a pet's quality prior to the start of a battle.
In addition to questing and running dungeons in the Broken Isles, players should also remember to visit their class hall, which is like the garrisons from Draenor, but themed around your character’s class.The quest lines in your hall provide valuable experience and open up important features, like artifact weapon upgrades, that will drastically up your character’s power.