Ask a Question

Global Datagen

sharmameera
Contributor

Re: Global Datagen

Hi Rupert,

Please see the below screen shot ... I have the file in the folder you mentioned. Just that the file name is different.

My script is simple, returning the current system date in yyyyMMdd format:

 

package test
import java.text.SimpleDateFormat

public class UpdatedDateGenerator{
def date = new Date()
sdf = new SimpleDateFormat("yyyyMMdd")  

public static long getDate() {
return sdf.format(date)
}
}

 

 

I am using the script by calling:

log.info test.UpdatedDateGenerator.getDate()

 

 

 

 

 

ScriptPath.png

 

Thanks,
Meera

 

 

 

rupert_anderson
Valued Contributor

Re: Global Datagen

Hi Meera,

 

Interesting... I think the problem might be that your groovy script's file name doesn't exactly match the name of the containing file? Please can you try changing the name of your file to UpdatedDateGenerator.groovy? When I have a mismatch between the class and file name then I also get the same error! (also when checking please make sure SoapUI has reloaded your script, restart it if necessary)

 

Now, as a java programmer of many years I assumed Groovy was the same and automatically made the class and filename match, but I believe that Groovy does not have this rule.. so, if this is the problem, then it may be a peculiarity of SoapUI

 

Let me know how you get on,

Cheers,

Rup

Author of SoapUI Cookbook
sharmameera
Contributor

Re: Global Datagen

Hi Ruport,

I tried that ... changed the filenme to match the Class Name, but am still getting the error. Following is my SoapUI Log:

 

Fri May 15 13:40:39 MST 2015:INFO:C:\Program Files\SmartBear\SoapUI-Pro-5.1.2\bin\scripts\test\UpdatedDateGenerator.groovy is new or has changed, reloading...
Fri May 15 13:40:39 MST 2015:INFO:Resetting groovy class cache due to 1 modified file
Fri May 15 13:40:58 MST 2015:ERROR:An error occurred [No such property: test for class: Script1], see error log for details

Well, thanks for helping. Please let me know as and when you are able to diagnose the problem. I will try at my end too and update the post if I find any thing.

rupert_anderson
Valued Contributor

Re: Global Datagen

Hi Meera,

 

Dam! I really thought that would be it, as like I said, not setting the filename equal to the Groovy class name results in the same error for me.

 

Apart from you being on Windows and me on a Mac, we both have the same version of SoapUI Pro (5.1.2), so hopefully we can eventually find out whats wrong...

 

To maybe rule out any issue with my particular example, have you got those demo Groovy scripts in the /scripts folder e.g. scripts/soapui/demo/Greet.groovy ?

 

If so please give the following a try in your Groovy TestStep:


import soapui.demo.Greet

def greet = new Greet("Rup", log)
greet.salute()

Greet.salute("Rup", log)

 

If the problem is the same as before, I would expect the import to fail, as resolving the class seemed to be the problem before..

 

Aside from this, which Java version are you running SoapUI with? I am trying to think of differences between our systems that might cause the issue...

 

Cheers,

Rup

Author of SoapUI Cookbook
rupert_anderson
Valued Contributor

Re: Global Datagen

Hi,

Did you get anywhere with this in the end?

By the way there are probably 2 alternatives to do your data gen if you cant face this approach anymore:-)

Cheers,

Rup

Author of SoapUI Cookbook
sharmameera
Contributor

Re: Global Datagen

Hi Rupert,

Sorry was unable to respond earlier. Am facing some issues with my SoapUI licence.

Will check the things out and update as soon as my SoapUI starts working again ...

Icing on the cake 🙂

rupert_anderson
Valued Contributor

Re: Global Datagen

Hi,

No problem - sorry to hear about the licence problems!

If you end up using the Open Source version, I reckon we still should be able to achieve a similar data gen using other means.

Cheers,

Rup

Author of SoapUI Cookbook
sharmameera
Contributor

Re: Global Datagen

Hi Rupert,

Good news (or not) I'm back 🙂 Finally got my SoapUI license stuff fixed. Now I am using Ready API (hopefully with no further licensing issues). Bad news, is that I am having the same issues as before.

So, I tried out the same steps as mentioned in your previous mails.

Getting the same error, for SequentialIdGenerator... No such property: test for class: Script1.

 

My SequentialIdGenerator... script is in the test folder which is at the location:

C:\ReadyAPI131\ReadyAPI-1.3.1\bin\scripts\test

The script has the same steps as mentioned in your mail previously.

One thing I don't remember mentioning earlier, is that my DataGen step is in my test suite -> Test case level. Does it have to be here or at some 'global' level since I am trying to create global datagen.

 

Also, in one of  your previous mails, you mentioned a script step import soapui.demo.Greet. Now that I have the ReadyAPI, how would this step change?

 

Thanks,

Meera

sharmameera
Contributor

Re: Global Datagen

Also you had asked about my Java version...

Please see the attached information

rupert_anderson
Valued Contributor

Re: Global Datagen

Hi Meera,

 

Welcome back! Although I have probably been pretty quiet on this forum too since we last spoke! (started new contract have been too busy to post much)

 

Ok, glad you've got your licence sorted out. I can't say that I am very surprised that the same problems show on Ready API, as large portions of the code base are probably still shared, despite the new UI.

 

Just warming my brain up on this topic, I think maybe the best thing to do first is for you to try that demo script, because if it works it means your script probably has an issue and if it doesn't then it probably means that your script could be fine (as it is for me) and there is some deeper/external setup issue which we might have to refer to SoapUI support (which is included in your licence fee of course).

 

So, is that scripts/soapui/demo/Greet.groovy script present in your install? If so please try it out with something like:

 

(try in a Groovy TestStep):


import soapui.demo.Greet

def greet = new Greet("Meera", log)
greet.salute()

Greet.salute("Meera", log)

 

Let me know how it turns out,

 

Cheers,

Rup

Author of SoapUI Cookbook
cancel
Showing results for 
Search instead for 
Did you mean: