This is called sarcasm.
Main Entry:sar-casm
Pronunciation:'sar-,ka-zem
Function:noun
Etymology:French or Late Latin; French sarcasme, from Late Latin sarcasmos, from Greek sarkasmos, from sarkazein to tear flesh, bite the lips in rage, sneer, from sark-, sarx flesh; probably akin to Avestan thwares- to cut
Date:1550
1 : a sharp and often satirical or ironic utterance designed to cut or give pain <tired of continual sarcasms>
2 a : a mode of satirical wit depending for its effect on bitter, caustic, and often ironic language that is usually directed against an individual b : the use or language of sarcasm <this is no time to indulge in sarcasm>