The systemd included in ubuntu zesty doesn't work nicely with dnsmasq by default, which is a pain if you are a developer and want to setup a local .test or similar domain. The way around this is to change the /etc/systemd/resolved.conf and uncomment/add a line like:
DNSStubListener=no
Then setup you dnsmasq as normal, probably by creating a file /etc/dnsmasq.d/test with the contents:
address=/test/127.0.0.1
Then restart, and your .test domain should be good to go, and dnsmasq is now handling all the lookup duties, instead of systemd-resolver