Well.... I really don't think calling this 'testing' is completely accurate. Testing indicates that it is something that can be passed or failed.
It's all part of negotiation. It is an indicator that a woman is at some level interested in you, but she isn't really in love with you yet, or if she did at some point, she is losing it.
I don't think that most women do this intentionally, it's an emotional reaction to what is happening.
A woman that is head over heels for you, will do anything to keep you. A woman in love will abandon her kids, turn her back of friends and family, will rob banks for you... Anything less than this... well it's negotiation. She isn't completely feeling it and she is tying to make compromises which you the man have to pay for.
If you cave, and start giving in, it will begin a vicious circle where you have to do more and more because she will begin to lose respect for you. If you don't give in... she will either self-correct, or drift off. Truth is she will likely drift off, because she intuitively knows the chemistry is not there or has gone.
I know I like using cars and car sales as a metaphor, but car buying really is a mix of emotional and rational decision making and is a good analogy. We all have a car that we 'love', that perfect car that all things being equal you want to have... what that is changes from person to person. If you shop around and can not find the car you 'love' for what you are willing or capable of paying for, you end up settling for something close... but you are not going to be willing to pay full price... so you push back, ask for price reductions, more options... you are increasing benefit to offset diminished interest. This is what is called 'testing'.
Now imagine you bought that perfect car, but your needs change (life gets in the way), and you want or need something else. You will continue to defend your purchase because no one likes to admit the made a mistake, but you are not happy.. you will be grumpy, you might even try to modify your car so that you are happy with it again. This is 'testing' for a relationship.
Now imagine that you have unlimited options, and can buy a new car every time you want... without any ramifications. THIS is women today. When she ties of the dude she is with, she can just go get another one if she can not emotionality manipulate you into something she is happy as you surrender who you are.