I don't think you can tell right away because of two factors: (1) it is difficult to know how much of what a person is projecting is their true self down deep, and how much is a presentation -- we all do this to some extent; (2) to some extent friendship is influenced by circumstances, so that if you don't have a chance to spend a lot of time together you may never develop the deep friendship.
I think a big part of friendship depends on shared experiences. You have a history together that means something to both of you.
Through the days of our life we stumble upon many . With some of them is love at first sight (love as in agape not eros), others we hate from the moment we lay our eyes on them and others just pass away unnoticed. How can we tell if the one we just met will be our friend for life, our enemy or just one of the many faces we won"t see again. ? Is it really necessary to put him/her to a test or can we know for sure from the begining ?