Forum Discussion

rumcajz's avatar
rumcajz
New Contributor
13 years ago

LoadUI 2.0.2 - Groovy script through Geb Runner exception

Hi guys,

I have an website accessible through HTTPS (that's why I am using LoadUI 2.0.2, newer versions do not work with HTTPS) that I need to load-test using realistic test cases. The we site does a lot of AJAX calls.

The approach I am trying to take is, automate the test cases using GEB, then run then through LoadUI.

I have installed Eclipse Juno, installed Groovy/Grails Tool Suite, created a Groovy project, added these two jars to classpath:
geb-core-0.7.2.jar
selenium-server-standalone-2.26.0.jar

and wrote a script like this, just to test if this is going to work:

import geb.Browser

import org.openqa.selenium.htmlunit.HtmlUnitDriver

import com.gargoylesoftware.htmlunit.BrowserVersion


HtmlUnitDriver myDriver = new HtmlUnitDriver(BrowserVersion.FIREFOX_3)
myDriver.setJavascriptEnabled(true)

Browser.drive( new Browser( driver: myDriver ) ) {
go "https://xxx.xxx.xxx"

sleep(5000)

$("#loginusername").value("xxxx")
$("#loginpassword").value("xxx")

$("#ext-gen46").click()

sleep(10000)

assert $("#ext-gen189")
}


When run from Eclipse, it runs fine. When run from LoadUI (GEB Runner) it gives me an exception in the Output log saying WebDriverException class can't be found.

I added both jars (geb-core and selenium-standalone-server) to LOADUI_HOME_DIR/ext but this does not fix the problem.
Although the class is present in selenium-standalone-*.jar.


Two questions:
1) Is my general approach correct?
2) How can I get this to work?

I've spent the whole week on this and I am really frustraded by such basic functionality being so annoyingly difficult to get to work.
Please help, anybody...

Cheers,
Radek
  • slashzero's avatar
    slashzero
    Occasional Contributor
    Hi there,

    I don't have a solution for you, however I am having the same issue (loadUI 2.1.2). GebRunner in loadUI refuses to make any requests over HTTPS. It works over HTTP, but 99% of out site is over SSL.

    I generally get this error, even just trying to connect to https://www.google.com !


    ERROR:Error connecting socket: Connection refused: connect


    NOTE: The scripts run 100% perfectly fine in the Groovy console.
  • We'll have a look at this after the LoadUI 2.5 release (I added it to our backlog [LOADUI-207]). It should be an easy fix.

    Thanks for letting us know

    Henrik
    SmartBear Software
  • After spending a few days with this issue, I discovered a potential workaround. I added some log.info() lines to the GebRunner.groovy component, and it enabled me to see a NoClassDefFoundError with javax.security.auth.x500.X500Principal. This class is part of Run Time (rt.jar), so it was concerning why it wasn't available. Like you, I put rt.jar in both LOAD_UI_HOME/ext and LOAD_UI_HOME/bundle. Then I looked closer at OSGI, and found LOAD_UI_HOME/conf/config.properties. I found some properties in which I could specify the X500Principal's package (namely, org.osgi.framework.bootdelegation). Once I added the javax.security.auth.x500 package to that line, and restarted LoadUI, I was able to see SSL working! This is only a workaround however, so your mileage may vary.
  • slashzero's avatar
    slashzero
    Occasional Contributor
    Bitflip, you are my hero! This totally solved it for me! THANK YOU!