When I set one of my commanders to cast certain spells during the battle, they don't seem to follow through, such as setting them to cast Will of the Fates, Doom, Army of Lead, Mass Regeneration and Gaia's Blessing, but the commanders seem to ignore this and cast whatever spells the AI thinks is more helpful.
The spellcasting AI will avoid using gems if the opposing army is not deemed to be enough of a threat. This is to avoid wasting gems for that type of spells when attacked by a single scout or similar throwaway chaff.
There are various threads on this subject, but you are better off asking in the Dominions 3 forum, since it is active, unlike this one. This issue is the same for both Dom2 and Dom3.