Yes, you can. By leaving components unplugged you would simply have some pins powered that are not in use. But even with all your components plugged in, you would still have some unused, powered pins on your board, so I wouldn't think too hard about that. In some cases it might be needed to mount e.i. fans to cool your electronics while running, but for testing a few stepper motors, you will be just fine.

Exactly how you would address each individual motor depends on your setup, however. My best bet would be to simply rely on your "default" firmware (such as Marlin), and then run commands for testing through Pronterface/PrintRun or similar.

Alternatively, you could upload your own sketch/firmware to the Arduino, and manipulate each stepper driver individually. This is a somewhat more advanced option, though.

When building a RAMPS 1.4 based printer, can I safely plugin just some of the components to test if they are working?

If I need to test out some of the components of a RAMPS 1.4 based 3D Printer, can I only plug some of them into the board (not all of them) and test them out?

I'd like to test out the NEMA 17 motors without testing the heated bed or extruder. Is this safe and why?