It is not compulsory to test the cointegration before testing the causality between the variables. However, if there is cointegration then should be evidence of causality (at least in one way).
I have to correct my first answer: it is not compulsory to test the cointegration before testing the causality between the variables. However, if there is cointegration then it should be evidence of causality (at least in one way). If there is causality but not cointegration, there are contraditory results.
You can see this paper: Article Causality, Cointegration, and Control
I presume that your variables are I(1). Say you have three variables X, Y and Z and that there is one cointegrating vector. (1, \beta_2, \beta_3). Then the vecm representation would look some think like
Y (or Z) may granger cause X in two ways. First if \gamma_1 is not zero causality may be transmitted through the cointegration relationship. Secondly the causality may be transmitted through the lagged difference terms. This causality through the lagged difference terms may occur even if there is no cointegration. (Carlos A. Carrasco is not correct when he says that if there is causality but not cointegration there are contradictory results)
When you have I(1) variables standard tests for Granger Causality do not have standard distributions. You should read your software manual to ensure that this point is covered. More details are in Lutkepohl (2006), New Introduction to Multiple Time Series Analysis, Springer.