Can I use grape on soapUI? - groovy

I really don't know If I can or not since I've been researching on the internet and I haven't seen anything about this topic.
If I try to use the following on soapui (groovy script)
#Grapes([
#Grab(group='net.sf.json-lib',
module='json-lib',
version='2.3',
classifier='jdk15'),
#Grab('xom:xom:1.2.5')
])
import net.sf.json.JSONObject
import net.sf.json.xml.XMLSerializer
I'm getting an error on Soapui that says "java.lang.NoClassDefFoundError: org/apache/ivy/core/settings/lvySettings" , So I really don't know If grape is not possible to be used on soapUI or I'm failing on some step.
Thank you guys.

Yes but I have to add ant jar and ivy jar to soapui/bin/ext otherwise it's not going to work.

The above answer does not work for SoapUI 5.7.0, you must add the Ivy JAR to %SOAPUI_HOME%..\lib
Source: R2 Blog

Related

GPars is part of Groovy but not in the API docs? Why can't I import?

http://www.gpars.org/guide/guide/gettingStarted.html#gettingStarted_downloadingAndInstalling
It says that GPars has been incorporated into Groovy. If so, why can't I find it in the API documentation for Groovy? Why is it that my import statements don't seem to be working? I see the library in my Groovy distro:
user#box /opt/stuff/groovy $ find . -name "*gpars*"
./lib/gpars-1.2.1.jar
user#box /opt/stuff/groovy $
gpars is indeed shipped with groovy distribution - as you can see under $GROOVY_HOME/lib - but it's still a separate library.
If you use groovysh or groovyConsole, gpars is automatically added to classpath and ready to use.
However if you need to use gpars in a separate application managed by gradle or maven you need to define a dependency to fetch and use gpars
You can also add this to the top of your Groovy script or in the Groovy console, which has built in support for Grape's #Grab annotation:
#Grab(group='org.codehaus.gpars', module='gpars', version='1.2.1')

Could not instantiate global transform class org.spockframework.compiler.SpockTransform

I am trying to use a different location for external jar in soapUI. I updated the soapUI batch file by adding the below line.
set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.libraries="C:\Program Files\Groovy\Groovy-2.1.6\lib"
Now when i open soapUI and try to create an activexobject using scriptom(see below)
import org.codehaus.groovy.scriptom.*
def tdc = new ActiveXObject ('TDApiOle80.TDConnection')
I get the following error, the error seems weird because i know i am using groovy 2.1.6 as you can see from the path.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/C:/Program%20Files/Groovy/Groovy-2.1.6/lib/spock-core-0.7-groovy-2.0-20120930.020057-22.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 0.7.0-groovy-2.0 is not compatible with Groovy 1.8.0. For more information, see http://versioninfo.spockframework.org Spock location: file:/C:/Program%20Files/Groovy/Groovy-2.1.6/lib/spock-core-0.7-groovy-2.0-20120930.020057-22.jar Groovy location: file:/C:/Program%20Files/SmartBear/soapUI-Pro-4.5.2/lib/groovy-all-1.8.0.jar 1 error
Does anyone know why i am getting this error and what i can do to fix it?
I believe SoapUI (at least 4.5.1) is bundled with Groovy 1.8.0
At least is was back in May this year (2013)
You could try the suggestion posted on the page to upgrade, or I guess you're stuck with 1.8.0 functionality (and the non-2.0 spock dependency)

Cucumber/gradle example not generating report?

I'm investigating using gradle and cucumber together, and found this lovely example in cucumber's github.
So, I cloned the repository and ran it myself. It failed, as it's configured to do, but I couldn't find the HTML or JSON report that it appears to be configured to output. I say appear because I'm brand new to cucumber, but this class would seem to indicate where it'll put it:
#RunWith(Cucumber.class)
#Cucumber.Options(format = {"pretty", "html:build/cucumber-html-report", "json-pretty:build/cucumber-report.json"})
public class RunCukesTest {
}
However, it's not appearing in the build directory after running gradle cucumber.There's no cucumber-html-report directory, not is there a cucumber-report.json file. I'm running it with Java 7 and Gradle 1.6, if it matters.
Ideas? Is this a known issue with the Cucumber/Gradle integration?
The class name changed depending on the version of Cucumber you are using. It changed from json-pretty to json.
When running the 'cucumber' task on this example the generated cucumber report is located at 'build/cucumber-html-report/index.html'. Running the 'test' task fails as it seems that gradle has problems to create the test report for the cucumber created tests (file name contains spaces) I need to dig a bit into this to see how this can be fixed in gradle.
cheers,
René
The cucumber-jvm-example doesn't do reporting using gradle cucumber, but does do it with gradle test. However, gradle test will have a couple issues, namely showing a "null" test of sorts.
A workaround to this, if need be, is to add the formats to the args of the javaexec that runs cucumber. For example, in build.gradle:
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--format', 'html:cucumber-html-report', '-f', 'pretty', '--glue', 'gradle.cucumber', 'src/test/resources']
}
I had an error with that very same line (taken from this tutorial).
In order to resolve, had to change the third parameter from "json-pretty" to just "pretty"
So this is my final code line:
#CucumberOptions(format = {"pretty", "html:target/cucumber-html-report", "pretty:target/cucumber-report.json"})
BTW,
#Cucumber.Options is deprecated, we should use CucumberOptions

Can not use groovy step definitions with cuke4duke

I have a working environment to run acceptance tests using cucumber/capybara, recently I have been trying to use cuke4duke from the command line through jruby (no maven, no ant) so I can define my step definitions in groovy as I am more proficient in groovy/java than ruby. Using the Calculator example from https://github.com/cucumber/cuke4duke/tree/master/examples/groovy
I get the following error:
groovy/lang/Closure (Java::JavaLang::NoClassDefFoundError)
looks like this line is failing for some reason 'this.metaClass.mixin(cuke4duke.GroovyDsl)'
and obviously I need it to make the groovy dsl available.
I've tried to run cuke4duke --jars 'folder where groovy.jar is' but I get the same result :(
Env:
jruby 1.6.3
cuke4duke 1.0.2
ubuntu 10.x
groovy 1.7.8
jdk 1.6
Any help will be much appreciated as I have not found anything relevant on google..
Cheers,
Rafael.
Interesting question. The best source of information is the Cukes mailing list. This has come up before, see http://groups.google.com/group/cukes/browse_frm/thread/7a9787cd17134c4d/0e42f88225335db2. Hopefully that will get you started. Also, if all else fails, it really wouldn't take long to get proficient with Ruby :).

cannot import groovyx.net.ws.WSClient from either groovysh or groovyConsole

hi i tried import groovyx.net.ws.WSClient from both groovysh or groovyConsole, adn netbeans ...
it just says "cannot resolve class groovyx.net.ws.WSClient"
any body gives me an hint?
thanks!
The Groovy WSClient is not part of the core groovy distribution. It is actually a separate standalone library. You need to download it separately and put it on your classpath or use the Grab annotation to download it at runtime.
Example:
#Grab(group='org.codehaus.groovy.modules', module='groovyws', version='0.5.1')
import groovyx.net.ws.WSClient
Note that this was done with Groovy 1.7.2. Previous to 1.7 #Grab was not available on imports. If you are using an older version, put the #Grab on a method.

Resources