Situation example: I make fun of a girl in a cocky-funny(nonoffensive) way and She gets mad,or pretends Being mad.(As a shit-test)

I usually to the following: 1 defuze the situation - problem is I look beta and non-conconflictual 2 I continue with cocky-funny and She still gets mad - and than I apologise or back down- witch makes me look unsure of myself 3 I try too change the subiect - witch only works sometime.

Any advice is welcome in how too deal with a girl that mad/angry/upset as a shit-test.