I think my lung experiences periodic spasms. How can I get this checked?

Airway spasms? If you mean airway spasms, then pulmonary function tests without and with bronchodilators, especially during one of these episodes of spasms.
Lung "spasm" I am not 100% sure what is meant by spasms, but wheezing is caused by bronchioles constricting. At a microscopic level, the muscles in the bronchioles are contracting. If you are experiencing wheezing, I recommend speaking to your primary care physician about a pulmonary function test.