I have a Page class and having some method which extract the Web page. Now I want to call these method into the Where block of Spock to pass as data provider. But when I call the method then it throws an error as it did not find it. But the same is accessible from out of Where block. Why is it so?
Example
def "Validate all article has its id"(){
when:"I am at Overview page"
at OverviewPage
then:"I should the article id of all article"
getAllCountOf(articleInfo).size() == actualCount
where:
articleInfo |actualCount
TopArticleListInfo.ARTICLE_THUMBNAIL |filter.getCount()
}
In the above code 'filter.getCount()' can not be accessed from Where block, But the same method is accessible in when or then block.
i want to understand the logic behind the scene It looks like , Where block is not able to find this method statically, need to create an object to call this.
When I tried the solution provided by erdi, But that also not solving the issue
when:"I am at Overview page"
at OverviewPage
then:"I should the article id of all article"
getAllCountOf(articleInfo).size() == page."$actualCount"
where:
articleInfo |actualCount
TopArticleListInfo.ARTICLE_THUMBNAIL |'getRowCount().size()'
Here getRowCount().size() substitute in "$actualCount". But still it throwing the error
Error Message
getAllCountOf(articleInfo).size() == page."$actualCount" | | | | | | | 10 | groovy.lang.MissingPropertyException: Unable to resolve getRowCount().size() as content for inca.sundashboard.pageobject.OverviewPage, or as a property on its Navigator context. Is getRowCount().size() a class you forgot to import? |