Uranos knows the exact calculation for this .. if he doesn't answer here, pester him ingame
To the best of my knowledge, it breaks down like this:
You have to calculate the total defence of one unit that is being attacked.
This is life (always constant!) + defence. Defence will equal the base defence of the unit, plus .5% per attribute gain from general & treasures. You need to add the tech bonus here, too. The one detail I am always sketchy on is whether the tech enhances the base attribute only, or the base attribute plus treasure attributes. Tech is non-cumulative, so it is one percent added 10 times, not one percent added to the previous figure.
Apply the same logic to the attack stat of the attacking unit. Take that final figure, and apply any unit type bonuses incurred. i.e. 150% for cav vs catapult.
Take the total attack of the attacking units, and divide it by the total resistance to death of the defending troops. You then have the number you'll kill per turn.
I always assume lvl 15 treasures when I'm calculating, and if you can see their stats I'm usually no more than 5-10% off a quick n dirty calculation.
n.b. because life is always constant, upgrading defence actually has much less of a beneficial affect than attack. So, if you're trying to work out "Do I upgrade attack so the enemy has fewer cats to return fire with, or defence to absorb more damage from the counter - attack?" - the answer is attack.