There are several ways to test the expression:
1. The easiest is simply to type the alerting expression as-is into the PromQL browser built into prometheus. If it returns any non-empty result set, then it's generating an alert.
Note that in this case you don't need the == 1 on the end, because absent returns an empty set when not absent (not a value of zero). For example, try these:
absent(up{instance=~".*wombat.*"})
absent(up{instance=~".*server.*"}) # where you have a hostname containing 'server'
By switching to graph mode you can see historical alert conditions too, i.e. whether alerts were firing at previous points in time.
This is good for more formal testing in a CI/CD pipeline, and for regression testing, or testing a rule in multiple scenarios.
Note that in general, it's better *not* to test on the absence/presence of a metric, but to have another metric which gives a success/fail value (like the "up" metric, which shows 1 for a successful scrape and 0 for a failed scrape). If you control your own metric generation, this is what you should aim for. However, there are some circumstances where you can't control the metrics being generated, so absent() might be necessary.