Truth is that nobody exactly knows. There are some theories, but reality is that it is very glitchy and doesn't always registrate battles won.
From personal experience, your best call is that a defender at least kills one Pokemon and subsequently let the attacker time out with one of his other Pokemon.