Magento: access a dropdown attribute value

In Magento it is possible to access a product’s attributes with a simple getter method. Let’s get the attribute test:

<?= $_product->getTest() ?>

This works as long as test is an attribute of type ‘text’. If the attribute is a dropdown, the method will just return the id of the selected option. To get the dropdown text, you need to call another method:

<?= $_product->getAttributeText('test') ?>