I created a jQuery DFP plugin to help me with this.
Using this plugin I can target ads at specific domains so all of my real ads are targeted at www.example.com and then I can make up some test ads within dfp that are targeted at stg.example.com and dev.example.com... really makes life easy!