我的項目沒有進行硒測試。在grails中使用硒-rc進行測試
的seleniumconfig.groovy有以下代碼:
selenium {
slow = true
singleWindow = true
browser = "*iexploreproxy"
url = null
defaultTimeout = 60000
windowMaximize = false
screenshot {
dir = "./target/test-reports/screenshots"
onFail = false
}
server {
host = "localhost"
port = 4444
}
}
的NewTests.groovy文件包含以下代碼:
package gtunes
import grails.plugins.selenium.*
import org.junit.*
import static org.junit.Assert.*
import static org.hamcrest.Matchers.*
@Mixin(SeleniumAware)
class NewTests {
class HomepageTests extends GroovyTestCase {
void testHomepageLoads() {
selenium.openAndWait "http://www.facebook.com/login.php"
assertTrue selenium.isTextPresent("facebook")
}
}
輸出STS是否顯示在運行命令「test-app是:
超時後30000ms com.thoughtworks.selenium.SeleniumException:30000ms 在com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97) 在com.thoughtworks.selenium.HttpCommandProcessor.doCommand(後超時HttpCommandProcessor.java:91) 在grails.plugins.selenium.SeleniumWrapper.open(SeleniumWrapper.groovy:53) 在grails.plugins.selenium.meta.AndWaitDynamicMethod.invoke(AndWaitDynamicMethod.groovy:32) 在grails.plugins。 seleniumWrapper.methodMissing(SeleniumWrapper.groovy:125) at automation.HomeTests.testHomepageLoads(HomeTests.groovy:14)
我的項目沒有通過測試。如何解決這個問題?
命令歷史記錄是:的getTitle() setContext(a87ff87c1ae249be99c6363519627de8) windowMaximize() setContext(HomeTests:測試網頁加載) 開放(http://www.facebook.com/login.php ,true)
我從來沒有能夠從IDE啓動硒測試,你有沒有嘗試過從命令行? 'grails test-app -functional' – 2012-02-08 14:12:07
我必須使用Spring源代碼套件來完成它。 – Shalini 2012-02-09 08:47:41