How to measure input/output impedance of amplifiers in a simulation?

What is the most effective way of measuring the input/output impedance of an amplifier in a simulation?

When I know the impedance I want to measure is purely resistive, I usually set up an input signal Vin and a test resistor as a resistive divider with the desired impedance. Then I compare the voltage values of the input/output and work my math to get a number for the impedance. Is there a better way?

I am using Orcad Capture with PSpice.

Create a current source whose AC magnitude is 1A. Connect one terminal to GND, and connect the other terminal to the appropriate pin of the device under test. Do an AC simulation, and plot the voltage on that pin. Remembering that $Z(j\omega)=V(j\omega)/I(j\omega)$, and since $I(j\omega)=1$ (because you've set it to 1), then the impedance is simply equal to the voltage: $Z(j\omega)=V(j\omega)$.