cancel
Showing results for 
Search instead for 
Did you mean: 

importing org.codehaus.groovy.scriptom.ActiveXProxy

Super Contributor

importing org.codehaus.groovy.scriptom.ActiveXProxy

Hello,
I am trying to launch internet explore via groovy script within a soapui testcase to validate some registration URL. I read the groovy docs and followed their example and was able to launch IE using groovyconsole. However when I add the same script in soapui groovy I get an error at the import statement. Can you tell me where I am going wrong. Seems like I have to import some jar and dll files from the scriptcom zip bundle. The URL and groovy script is shown below.
http://groovy.codehaus.org/COM+Scripting

import org.codehaus.groovy.scriptom.ActiveXProxy

// instantiate Internet Explorer
def explorer = new ActiveXProxy("InternetExplorer.Application")

// set its properties
explorer.Visible = true
explorer.AddressBar = true

// navigate to a site
explorer.Navigate("http://glaforge.free.fr/weblog")
Thread.sleep(1000)
explorer.StatusText = "Guillaume Laforge's weblog"
Thread.sleep(2000)

// quit Internet Explorer
explorer.Quit()

Thanks

Ali
14 REPLIES 14
Super Contributor

Re: importing org.codehaus.groovy.scriptom.ActiveXProxy

Hi Ali,

this is cool, I didn't know of this extension.. you could probably use it to script mercury objects as well (instead of creating a program that needs to be launched..)

Anyway, do as follows:
- put the 2 jar files in the \bin\ext folder
- put the jacob.dll file in the \bin folder

When starting soapUI you should get something like

10:46:47,125 INFO  [SoapUI] Added [file:/C:/workspace/core/ext/jacob.jar] to classpath
10:46:47,125 INFO  [SoapUI] Added [file:/C:/workspace/core/ext/scriptom-1.2.jar] to classpath


and your script should run just fine.. (it did for me at least :-)

regards!

/Ole
eviware.com
Super Contributor

Re: importing org.codehaus.groovy.scriptom.ActiveXProxy

I tried to use scriptCOM to create the mercury object initially but could not really figure it out and at that time I had most of the code done already. Once my current project is done I'm going to go back to this extension to see If there is a more graceful way of updating Quality Center from a groovyscript rather than launching an application.

Thanks for you help

Ali
Super Contributor

Re: importing org.codehaus.groovy.scriptom.ActiveXProxy

Ole,
on a side notice I notice that the soapUI installer never creates the
soapui/bin/ext folder. Is this expected ?
Super Contributor

Re: importing org.codehaus.groovy.scriptom.ActiveXProxy

Hi,

yes, you are correct.. you are "expected" to create this folder yourself :-)

Thanks for noticing, we'll fix this in the upcoming release!

regards,

/Ole
eviware.com
Super Contributor

Re: importing org.codehaus.groovy.scriptom.ActiveXProxy

Hello Ole,
I am having a little problem when using scriptcom + global groovy script + running from testrunner.

I have a groovy script in my script library - verify email in which i have an import statment
import org.codehaus.groovy.scriptom.ActiveXProxy
I call this verifyemail script from within my testcases. When I run from GUI view, the test passes with no problem. However when I run the test from command line using testrunner, I get the following error

Status: FAILED
Time Taken: 10
Size: 0
Timestamp: Thu Jul 19 11:10:58 PDT 2007
TestStep: VerifyEmail
ErrorSmiley Surprisedrg.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script1.groovy: 4: unable to resolve class soapui.Tvguide.ReusableScripts.VerifyEmail
@ line 4, column 14.
1 error

startup failed, Script1.groovy: 4: unable to resolve class soapui.Tvguide.ReusableScripts.VerifyEmail
@ line 4, column 14.
1 error


When I comment out import org.codehaus.groovy.scriptom.ActiveXProxy and run from command line it works fine. Seems like the scriptcom libraries are not getting loaded when running from command line

This one is urgent, quick reply would be really appreciated.

Thanks

Ali
Super Contributor

Re: importing org.codehaus.groovy.scriptom.ActiveXProxy

Hi Ali,

hmm.. do you get info on the loading of external libraries when the testrunner starts (like you get when starting the gui)? Also, be sure that the directory containing the testrunner is the current working directory when running..

regards!

/Ole
eviware.com
Super Contributor

Re: importing org.codehaus.groovy.scriptom.ActiveXProxy

here is what i see when I start the tests from testrunner. Also what do you mean by 'Also, be sure that the directory containing the testrunner is the current working directory when running..'


C:\Program Files\eviware\soapUI-Pro-1.7.5-beta2\bin>testrunner.bat -f"C:\Work\soapUI\TestResults\DeviceManagementService\ITG-ENV\build-
24" -r -j "C:\Workspace\QA\Automation\SoapUIScripts\ITG_env\DeviceManagementService.xml"
log4j:WARN No appenders could be found for logger (com.eviware.soapui.SoapUI).
log4j:WARN Please initialize the log4j system properly.
soapUI 1.7.5 beta2 Pro TestCase Runner
Configuring log4j from [jar:file:/C:/Program%20Files/eviware/soapUI-Pro-1.7.5-beta2/lib/soapui-1.7.5-beta2.jar!/soapui-log4j.xml]
13:19:54,122 INFO  [SoapUITestCaseRunner] setting projectFile to [C:\Workspace\QA\Automation\SoapUIScripts\ITG_env\DeviceManagementServ
ice.xml]
13:19:54,169 INFO  [SoapUI] Added [file:/C:/Program Files/eviware/soapUI-Pro-1.7.5-beta2/bin/ext/jacob.jar] to classpath
13:19:54,185 INFO  [SoapUI] Added [file:/C:/Program Files/eviware/soapUI-Pro-1.7.5-beta2/bin/ext/scriptom-1.2.jar] to classpath
13:19:57,654 INFO  [WsdlProject] Loaded project from [C:\Workspace\QA\Automation\SoapUIScripts\ITG_env\DeviceManagementService.xml]
13:19:59,076 INFO  [SoapUITestCaseRunner] Running soapUI tests in project [DeviceManagementService]
13:19:59,076 INFO  [SoapUITestCaseRunner] Running soapUI suite [GetAllDevices_Valid], runType = SEQUENTIAL
13:19:59,107 INFO  [SoapUITestCaseRunner] Running soapUI testcase [TC_DVM_01_1_01_GetAllDevices_validation]
13:19:59,169 INFO  [SoapUITestCaseRunner] running step [Delay [1000ms]]
13:20:00,185 INFO  [SoapUITestCaseRunner] running step [RandomizeUser]
13:20:00,732 INFO  [SoapUITestCaseRunner] running step [Properties]
13:20:00,732 INFO  [SoapUITestCaseRunner] running step [Transfer_CreateUser]
13:20:03,170 INFO  [SoapUITestCaseRunner] running step [CreateUser - Request 1]
13:20:08,576 INFO  [HttpClientSupport$Helper] Initializing SSL
13:20:10,170 INFO  [SoapUITestCaseRunner] Assertion [SOAP Response] has status VALID
13:20:10,170 INFO  [SoapUITestCaseRunner] Assertion [Match content of [Status]] has status VALID
13:20:10,170 INFO  [SoapUITestCaseRunner] running step [VerifyEmail]
13:20:10,185 ERROR [log] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script1.groovy: 4: unable to r
esolve class soapui.Tvguide.ReusableScripts.VerifyEmail
@ line 4, column 14.
1 error

13:20:10,185 ERROR [SoapUITestCaseRunner] VerifyEmail failed, exporting to [C:\Work\soapUI\TestResults\DeviceManagementService\ITG-ENV\
build-24\GetAllDevices_Valid-TC_DVM_01_1_01_GetAllDevices_validation-VerifyEmail-0-FAILED.txt]
13:20:10,232 INFO  [SoapUITestCaseRunner] running step [AuthenticateUser - Request 1]
13:20:10,373 INFO  [SoapUITestCaseRunner] Assertion [SOAP Response] has status VALID
13:20:10,373 INFO  [SoapUITestCaseRunner] Assertion [Match content of [Status]] has status FAILED
13:20:10,373 INFO  [SoapUITestCaseRunner] ASSERTION FAILED -> [Lcom.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionError;@1708f
9
Super Contributor

Re: importing org.codehaus.groovy.scriptom.ActiveXProxy

Hi Ali,

had you set the global scripts-path to something other than the default?

regards,

/Ole
eviware.com
Super Contributor

Re: importing org.codehaus.groovy.scriptom.ActiveXProxy

Yes.
New Here?
Join us and watch the welcome video:
Final Interview in the Series
API_testing_mistake#7
Top Kudoed Authors