For dialogue, they speak their own parts to test if it sounds believable. For the story, it runs in my head and is frequently revised. So for example. I'm starting the second book while my first one is being beta read. It opens with a protest that gets out of hand and results in arrests. I work out a piece then see that doesn't work then realize my character is a very intelligent hacker. She has to have the events planned out in detail. They can go wrong, but I have to show her planning in action. So I don't need her making decisions as the guards show up, the response needs to be planned so things happen as planned and then not.
Neither, I get deep into their heads and try to figure out things, sometimes it goes alright, and others it turns to horse pucky. Can't fry an egg in an imaginary pan (unless you're in Neverland).