I used to self harm. It was for emotional regulation purposes. Physical pain has been proven to release beta endorphins in the form of endogenous opioids and for some, this alleviates emotional pain. Some research has actually indicated that otc painkillers can relieve heartache, for example.
It was impulsive for me. I made a mistake, I deserved it. I was anger, I got in a fight, I was overwhelmed? Yep. I can remember getting into fights and ripping my earrings out to scratch myself without even thinking about it. I also would self harm to reduce numbness, but I preferred to burn in those situations. Replacing emotional pain with physical pain was the goal. It was like a pressure valve I had to release before I exploded.
Sometimes it was to spite people, or to feel unique and badass. I can relate to testing limits. It wasn't really badass though, because I couldn't cope with my feelings. I do not recommend it. The feelings one tries to suppress come back ten fold, which makes self harm worse: also wanting to test limits just makes the threshold of what you are willing to do expand to heights you'd never imagine prior.
You aren't the first person I've heard testing limits or seeing if they could go further with actual suicide. I've heard of people who hadn't heard of it before discover self harm that way. Esther in The Bell Jar cuts her calf for the reasons you cited. It's a tale as old as time.