Template tags are not methods of WP_Query
object. They are functions.
On the other hand have_posts
and the_post
are methods of WP_Query
.
So in your code you should use:
while ($test->have_posts()) : $test->the_post();
as you do, but then:
echo get_the_title();
echo get_the_content();
Also… if you want to echo these values, it would be much better to use the_title
and the_content
instead – there are some additional filters and actions fired up.