If you have ever interacted with a woman you and thought that she might find you attractive, you most likely have been tested by her. And with all probability you haven't even noticed it. To you, her behavior might have gone from totally normal to cold/weird/funny in an instant and you probably were baffled by it. But there is actually a good explanation for this behavior.
When a woman finds you interesting, but is unsure about you, she will most likely test you to see how you react. So, if you fail her tests, you are out and can do nothing about it. So the best strategy for you is to recognize her tests and respond to them accordingly.
One way women test you is exactly as explained above – they will go from totally friendly to "weird" to see how you react to it. So to pass these tests, you have to stay nonreactive and not make a big deal about it. Eventually they will become friendly with you again and interact with you as nothing happened.
Another way a woman might test you is to say something absurd to you, or do the exact opposite by staying silent. Again, like in the previous example, you can not react to it! Stay cool and talk to her as nothing happened. If she tries to provoke you by saying something that could make you react in some way, don't do it. Just remember why she is doing and don't start to stress about it that much.
Now since you know the reason why women test men, you also know what to do. Don't try to call her out on it, because she will just deny it. The best course of action is not to react to it because it's just a test of character you need to pass. And when you pass it, you will be attractive to her.