2012-04-05 74 views
0

为什么下面的Geb测试失败,出现以下错误。我不能在当时的区块拨打to SearchPage吗?“to SearchPage”来自“then”块的呼叫

Condition not satisfied: 

to SearchPage 
| 
null 

    at test.LogoutSpec.Verify that the logout takes the user to login page(LogoutSpec.groovy:35) 



def "Verify that the logout takes the user to login page"() 
    { 
     given: "I successfully logged in to the application" 
     to LoginPage 
     loginForm.with 
     { 
      loginClientCode = "testingclient" 
      loginSystemCode = "testingsystem" 
      loginUserId = "abc" 
      loginPassword = "password1" 
     } 
     loginButton.click() 

     at SearchPage 
     section == "Search Applications" 

     when: "I click Log Out link from user panel" 
     userPanel.logOutLink.click() 

     then: "I am redirected to the LoginPage" 
     at LoginPage 

     and: "My session is invalidated" 
     //TODO how to verify this 
     to SearchPage 
    } 

回答

0

then块用于声明。如果有帮助,你可以添加另一个时间,然后把to SearchPage放在when块中。