The basic procedure is that you connect the output of your transmitter to a spectrum analyzer or SDR, with a suitable amount (in other words, a lot) of attenuation between them. The basic connection is transmitter to high power attenuator to lower power attenuator to step attenuator to instrument (spectrum analyzer or SDR). Depending on what attenuators you buy and what power levels you?want to support, you may not need all three.
A spectrum analyzer is the instrument of choice for looking for wideband issues: harmonics and spurs far away from the transmitter frequency. You can use a spectrum analyzer for closer-in analysis as well, but there may be limitations depending on the analyzer you choose. The inexpensive tinySA is not good for this because its minimum RBW (receive bandwidth) is about 3 kHz; that won't give you a very detailed look at near-in issues. The newer tinySA Ultra has a minimum RBW of 200 Hz, which is considerably better and good enough for many purposes. Expensive analyzers often have much smaller minimum RBW ratings, down to 10 Hz or even 1 Hz. Another way to get a detailed look down to a few Hz is to use an SDR and SDR software with a high resolution spectrum display; PowerSDR (older FlexRadio rigs and some homebrew and small builder SDRs), SmartSDR (newer Flex rigs), SDR# (Airspy and some homebrew SDRs), SDRuno (SDRplay), and HDSDR (works with most hardware) can all do it. An alternative to using a dedicated SDR is to use the I/Q outputs that some new transceivers offer -- but that won't work if you want to test the transceiver itself! The spectrum displays that many new rigs have don't have enough frequency resolution or dynamic range to be ideal for this testing. (Exception: FlexRadio plus Maestro.)
The ideal input level to the tinySA family is about -30 dBm (one microwatt). The maximum safe input level is higher but the internal attenuators in the tinySA family introduce some distortion; Expensive spectrum analyzers usually accept larger signals, mostly by containing more robust attenuators; a Siglent SVA 1015X that I have had the opportunity to use will accept a signal up to?+30 dBm (one watt) and does not appear to have any significant performance compromises at that input level. (It's also a $1700 instrument, more than ten times as expensive as a tinySA Ultra.) I use a chain of three attenuators with my tinySA: a 20 dB attenuator rated for 150W, a 30 dB attenuator rated for 20W, and a 101 dB step attenuator rated for half a watt. (The large attenuator with the 150W rating is a recent addition so I can test rigs in the 100W class; I can omit it for testing QRP rigs and handhelds.) The total cost of the three attenuators, plus adapters and cables to hook everything up, was about $100, all spent at hamfests here in New England. All of my attenuators are rated up to 1 GHz or higher, making them suitable for testing radios through the 70 cm band. Microwave attenuators would cost more.
Figuring out how much attenuation you need for a spectrum analyzer is simple arithmetic; dB is a logarithmic unit, so all you have to do to calculate total attenuation is add the numbers. It's also useful to know the dBm equivalents of popular power levels: 100W is?+50 dBm, 10W is?+40 dBm, 5W is?+37 dBm, and 1W is?+30 dBm. To get a 100W signal down to the ideal level for a tinySA you need 80 dB of total attenuation to get from?+50 dBm to -30 dBm, with my equipment I would use the two fixed attenuators plus 30 dB on the step attenuator.
For SDRs, you will have to run tests to find the optimum input signal level for this type of testing. It will probably be -30 dBm or even lower; you will want a step attenuator as part of the chain. The testing method for receiver overload is simple. Start with a weak signal (lots of attenuation) and gradually increase it. You will see a carrier and possibly some near-in spurs if you're transmitting CW. (If you want to test SSB you can use a two tone audio generator as the input to the transmitter; you should then get a two tone signal similar to the ones you have seen in QST and other magazines.) As you increase the signal, you may see additional spurs appear above the noise floor of the SDR. So long as the carrier and the spurs increase at the same rate as you decrease attenuation your receiver is still behaving properly. When you start to see spurs that rise MORE QUICKLY in level than the carrier you are seeing distortion products in the receiver, and you have reached the point where receiver overload will affect the accuracy of your measurements; add back attenuation to the point just before you started to see the distortion products and do your measurements there. AGC in the receiver should be turned OFF for all these tests.
A resistive tap like the one in N6LN's post is an inexpensive alternative if you already own a suitable high power dummy load. (I didn't, but my two fixed attenuators plus a low power 50 ohm terminator make a fine 150W dummy load!) Since your homemade tap is being made with inexpensive resistors it won't be precise, so you should measure its actual attenuation (you can do that with a NanoVNA, or with a tinySA or any other spectrum analyzer plus a noise source) so you can make accurate power measurements.
Your spectrum analyzer plus attenuators, besides its uses for spectral purity testing, will probably be the most accurate RF power meter in your shack. Once you check your attenuators for their actual attenuation, even with inexpensive instruments like the tinySA, you should be able to measure RF output to an accuracy of 1% or better. Even better, the spectrum analyzer will measure the output at the desired frequency; if you test a signal with a lot of harmonic energy with a typical meter it will show more power because it's adding up ALL the signals coming out of the transmitter, not just the desired one.