Extract test webserver code into helper macro