For some reason, setup method doesn’t recognize the closure that came before it, because when this code gets put into a test suite and ran, it throws
MissingMethodException
about the closure I’m trying to call:
`
int initialNumberOfRows = 0
def findRowCount = {
initialNumberOfRows = 5
}
/**
- Some methods below are samples for using SetUp/TearDown in a test suite.
/
/* - Sets up test environment.
*/
@SetUp(skipped = false) // Please change skipped to be false to activate this method.
def setUp() {
// login and select the test company first
WebUI.callTestCase(findTestCase(‘Test Cases/TestCompanySelectGoesToDashboard’), [(‘shouldLogout’) : false, (‘shouldCloseBrowser’) : false])
// go to the “Discounts” page
WebUI.click(findTestObject(‘PageMenuOptions/a_Discounts’))
// determine the row count
WebUI.delay(5)
findRowCount()
}
`
I run that code and get greeted with the following exception message:
`
groovy.lang.MissingMethodException: No signature of method: DiscountsSuite.findRowCount() is applicable for argument types: () values:
`
The closure, as of right now, is a stub, but will be used to get the number of rows, after which we will delete as cleanup for the test suite (I make the rows via the test suite, I gotta clean em up!)