I do this all the time. Get a pair of known gain antennas. Point them at each other at your distance of interest (like 10 feet, 30 feet, whatever). Drive one of them with 10 dBm power level at the frequency of interest. Go to the other side and measure the received power. This is your "calibration"
then replace the first antenna/source with your device under test. sweep the DUT around in azimuth and altitude, and record the received power. Subtract out your source calibrated gain, and you have the gain in dBi vs azimuth and elevation.
It does help if you have a cheap antenna rotator, like they use for TV antennas, to move the DUT around. the one I have uses a wireless handheld remote to move it around, which eliminates the rotor control wires as a possible reflection/re-radiation source.
If possible, run the DUT off of batteries with very short wires
I have some plastic hinged holders that can change the DUT elevation manually.
I uses a lab signal generator and portable spectrum analyzer to do the above. But if you want to do this cheaply, get a 5V VCO and tune it with a potentiometer, and for the receiver you could use an analog devices log amp detector and measure the Vout.