unresolved dependency for httpbuilder in groovy script - groovy

I am trying to automation using groovy script in soapui for that I want to use http-builder. I worte code like this
#Grab(group='org.codehaus.groovy.modules.http-builder',modules='http-builder',version='0.5.2')
import statements
but when I run this it shows following exception:
org.codehaus.groovy.control.multipleCompilationErrorException:startup-failed Error Grabbing grape[unresolved dependency]javaRuntimeException
why I am getting this error. Is there any proxy problem?if yes where to add it?Please help me out

SOAPUI doesn't support Grapes as dependency management by default, so #Grab annotation doesn't work.
An alternative way to use http-builder is download all necessary libraries and place it on SOAPUI_HOME/bin/ext directory, restart SOAPUI in order to load it. Then you can use it on Groovy script testStep adding the necessary imports and so on.
Hope this helps,

Related

Executing cucumber test from custom module in quarkus

I am trying to execute cucumber test from custom/another module than test however facing issue.
java.lang.IllegalStateException: Unable to locate CDIProvider
at javax.enterprise.inject.spi.CDI.findAllProviders(CDI.java:121)
at javax.enterprise.inject.spi.CDI.getCDIProvider(CDI.java:82)
at javax.enterprise.inject.spi.CDI.current(CDI.java:64)
at io.quarkiverse.cucumber.CucumberQuarkusTest$CdiObjectFactory.getInstance(CucumberQuarkusTest.java:184)
Not sure how to provide CDI to custom module. Any help on this would be appreciated.
I am able to execute cucumber test from test module however I want to separate it from JUnits.
The code is attached in Git issue:
https://github.com/quarkiverse/quarkus-cucumber/issues/38

Trying to use mockito with Arquillian but having some problems

I was tring to use mockito with arquillian.
I used with simple JUnit and it runs fine although i am trying to figure out the deployment for arquillian which is where i think the problem is !!!
Can anyone help me to figure out ?
Thank you.
Here is the link to my junit file and pom file
When you're using external libraries in your tests, you must make sure those libraries have been added to the microdeployment.

jenkins with groovy postbuild .Not able to execute anything in groovy script field

I need to run set of code after the build is completed. I use groovy postbuild plugin(version2.2). I am new to jenkins and groovy. I tried simple println but it is not working. I tried something like this and its also not working. I dont even see error message if i make any syntax or something.
and i see this output
can anyone tell me how do i use groovy postbuild ?
Your groovy postbuild configuration and syntax look fine to me.
I assume you are experiencing this with a Build Flow type job.
I can reproduce this behavior with a configuration similar to yours and I suspect that it is related to the build flow.
One solution that worked for me was to enable the Flow run needs a workspace checkbox in the Flow section of the job configuration and start a new build.

How to define simple global function in soap ui for use by every mock operation or service (groovy scripting)?

I have some common code that gets called while processing the response for every mock operation in a mock service in SOAP UI.
How and where can i define a public globally accessible function so that i can remove code duplication.
Here is one solution, firstly you need to create project as below,
soapUI Project
|__ Test Suite
|__Test Case
|__Test Steps
|__Global Groovy Script
|__Mock Response 1
|__Mock Response 2
So, within the "Global Groovy Script", you can create accessible function. Please notice that you cannot access the function from different test case.
You can put the function in a separate script file with a .groovy extension and save this script in the scripts folder , this is in the directory where SOAP UI is installed.
SoapUI Pro adds the possibility to have a central library of Groovy
Classes that can be accessed from any script within SoapUI, which can
be useful for centralizing common tasks and functionality and for
creating SoapUI extensions. Use as follows:
Specify which folder to use in the SoapUI Pro Preferences tab (default is /scripts). SoapUI Pro will check this folder for files
with the "Groovy" extension and compile these upon startup. The
folder is then checked periodically (every 5 seconds) for updates and
new or existing scripts are compiled and re-compiled if necessary.
Scripts should be placed in folders named after their containing package, ie a script in the package soapui.demo should be in a
soapui/demo folder under the specified scripts folder.
The compiled classes are added to the parent class loader of all Groovy scripts, you can access them as standard java classes.
You can read more here

How do I start automation using groovy script in soapUI Pro?

I'm new SoapUI Pro with automation. With the help of the SoapUI Pro tool, I have tested only request and response for the service so far. If I want to automate this process by writing script using groovy inside SoapUI Pro tool how do I do it?
What are the per-requisites required to learn Groovy script?
Please anyone guide me..
Thanks in advance!
Steps for a navie to start SoapUI Test Automation
Understand XML DOM (http://www.w3schools.com/xml/xml_dom.asp) in detail. What's it all about.
Understand how SoapUI Works. Go to their website.
Identify what exactly is your requirement that you want to automate. It could be as simple as Running a Test Suite for already present/created Test Suite or to Generate Realtime XML Request from bindings, Connecting Excel to fetch data, Generating XML Response and Validating, Generating log etc. Sky is the limit.
Go Step-by-Step and you should be all good to automate SoapUI.
Answering here to the initiated question.
You need understanding of any basic programming/scripting, OOP capability/knowledge, REST/Http/Https and JSON/XML.
Don't worry it's all easy, first double click on any test case/suite, you will see it's editor, in that there is a option for "setup script" for before running tests.
Please analyze what all variables on top are listed, like : runner/testRunner, testCase/testSuite, logger, context...etc.
There are methods from which one can get another handle, like from testCase you can get testSuite/teststep via respective methods, so those you need to know.
The idea is to run a testCase/Suite/Step by script, which you already have configured, you can set header for each api and also properties too. You can even do almost everything via Groovy/JavaScript scripting in soapui.
I am actually going to create a blog having required groovy scripts to do automation regarding, REST API execution and testing.
I will be posting that link here.
Thanks!

Resources