简体   繁体   中英

testing using selenium-rc in grails

my project is failing the selenium tests.

The seleniumconfig.groovy has the following code:

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                             
    }                   
}

The NewTests.groovy file contains the following code:

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")
    }
}

the output STS is showing on running the command "test-app is :

Timed out after 30000ms com.thoughtworks.selenium.SeleniumException: Timed out after 30000ms at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97) at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91) at grails.plugins.selenium.SeleniumWrapper.open(SeleniumWrapper.groovy:53) at grails.plugins.selenium.meta.AndWaitDynamicMethod.invoke(AndWaitDynamicMethod.groovy:32) at grails.plugins.selenium.SeleniumWrapper.methodMissing(SeleniumWrapper.groovy:125) at automation.HomeTests.testHomepageLoads(HomeTests.groovy:14)

My project is failing the tests. how to go about rectifying this?

the command history is :getTitle() setContext(a87ff87c1ae249be99c6363519627de8) windowMaximize() setContext(HomeTests: test Homepage Loads) open(http://www.facebook.com/login.php, true)

Do you have firefox in your PATH variable? Selenium need to start firefox instance from your installation dir and need to know where you have that dir.

I was facing the same problem. Your settings look fine to me. Try out this command:
test-app :selenium

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM