Some novelists advocate intense exercises to pre-determine a character's personality before one starts to write. These explorations get down to such details as the character's favorite color, food, and music. For me, this approach is too abstract and artificial.
I find that my characters reveal their personalities to me scene by scene, just as one gets to know a person over time in real life. Somehow, the people I invent are not entirely controlled by me, but develop as they are faced with (or cause!) new situations in the plot. The way they constantly surprise me is a wondrous, miraculous thing.