Loops?

Say I have 4 menu items each one should hover and revel a div tag, each when clicked should navigate to a specific web page, each should exist on the home page. I’ve created individual test cases for each of these test multiplied by the number of menu items. Is there a way I can create a loop? Feeding in the object repository item as a variable? I did try this as a for loop in a single test case however I could not get an array declared of the object repository items. Also I’d like them to fail individually instead of a single failure.

I was hoping to do the following:


TestObject[] testMenuItems = new TestObject[]{findTestObject('...'), findTestObject('...')};

for(int i=0; i<testMenuItems.length; i++) {
	WebUI.verifyElementPresent(testMenuItems[i], 1, FailureHandling.STOP_ON_FAILURE)
	WebUI.verifyElementClickable(testMenuItems[i], FailureHandling.STOP_ON_FAILURE)
}