Put bomb underground - in a drilled hole for modern weapons type warheads. or in an mine for large N Korea type devices.
Retire to a safe distance
Press big red button and put fingers in ears.
If you are actively trying to design warheads you fill the hole with lots of sensors to measure energy, radiation, pressure etc and use this data to refine your computer models. If you are just trying to show you are a nuclear power - then you just let everyone know you are going to do it.
4* Note - because the bang travels at the speed of sound, if you are a prudent distance from the device you have plenty of time to put your fingers in your ears AFTER pressing the button.