Ask a Question

How to write a reusable script Library

NaveenKumar
Not applicable

Re: How to write a reusable script Library

Super Sir!!!... this helped me a lot...
korrrro
Occasional Contributor

Re: How to write a reusable script Library

Hope somebody still follows this post.

 

Script works fine for me when I use 1 method only in the class, but always when I try to add another one none of them work then and return java.lang.NullPointerException: Cannot invoke method on null object.

 

Any ideas/solutions ?

shalivardhan
New Contributor

Re: How to write a reusable script Library

Hi , 

 

i got object by step 7 in a script .. do i need to again run step 7 if i want to get object in another test step.. i tried by using context.example but it returning null in another step if i execute step 7 it returning object

 

How to set object into global context 

 

Thank you , 

Vardhan 

 

shalivardhan
New Contributor

Re: How to write a reusable script Library

 
shalivardhan
New Contributor

Re: How to write a reusable script Library

Hi MartinSpamer

 

I would like to use that object in multiple scripts without running step 7 again and again how to do that 

 

Thank you , 

vardhan 

chiragverma123
Contributor

Re: How to write a reusable script Library

I am guessing we cannot reuse groovy scripts in SOAPUI free version?

babusr01
Contributor

Re: How to write a reusable script Library

Hi Martin,

 

its really helpful , But how can we create groovy jar file and get in into soapui project.

 

Thanks

babu

nmrao
Community Hero

Re: How to write a reusable script Library

@babusr01,

 

@rupert_anderson wrote a nice article abou the same here. Hope you can leverage it.



Regards,
Rao.
krogold
Regular Contributor

Re: How to write a reusable script Library

Hello,

 

Thanks for sharing, it works well but I have one question : how do you manage step 9 (The instance can be added to the Global context if you want to use it across SOAPUI projects.) ?

I would like to use it within one project but I don't even manage to use it between two different test steps (as the context is different), so, how can you store it in the global context so it could be reuse with minimal processing ?

 

thank you

 

Alexandre

denizov23
Frequent Visitor

Re: How to write a reusable script Library

Thank you for sharing.

 

Is there any way to use this script from the "script assertion"? 

It does not have a testRunner, only log, context, and messageExchange.

 

Thank you in advance

cancel
Showing results for 
Search instead for 
Did you mean: