To see what the cation of the substance is you normally first add sodium hydroxide to the solution.
If the solution turns makes a white precipitate then it is either Magnesium, Calcium or Aluminium. To distinguish between them, sodium hydroxide is added in excess Aluminium goes colourless. In a flame test, heat over a bunsen burner and observe the colour changes. Calcium will go brick red and Magnesium goes lilac. Sodium goes golden yellow and Copper (II) goes apple green.
If you add sodium hydroxide and the solution forms a coloured precipitate then it is a transition metal. If it goes blue then it is copper. If it goes murky green then it is Iron (II). If it goes reddish brown then it is Iron (III).