autotests: replace duplication with for loop

Authored by dfaure on Dec 27 2017, 9:34 AM.