Add Query tests

@xl76: Please review.