Add dynamic query tests