Question 1: My captain have had bad luck. He has madness -> frenzied, but he has also madness -> stupidity. What is the order of effects? Does stupidity override frenzied rules or vice versa?

Question 2: When trying to roll spell's difficulty test, is it already counted as casting the spell? Because if difficulty test gets failed it means model didn't cast the spell. So model can't shoot when casting spell, but can he shoot if this difficulty test is failed?