Extended insert_test method with debug option