Forum Discussion

Liberty_Informa's avatar
Liberty_Informa
Regular Contributor
11 years ago

Hanging cron jobs

Hi

We run automated tests at midnight using cronjob on unix server. There are currently 4 jobs that run in the interval of 30 minutes. Each job has to run more than 1000 tests on certain environment. Each job run same tests however on different environment instance.

Many times I see not all the jobs are completed successfully. When I investigated hanging jobs in the morning I could see something interesting in the logs. Certainly it has to do with the soapui-settings file. We use this file to store global variables. (some variables are quite large xml as we store complete responses. The data in these xml's we use in the subsequent tests)

I am pasting what I am seeing these couple of statements that are repeated in the soapui.log file

 2013-05-22 01:55:45,577 INFO  [DefaultSoapUICore] Reloading updated settings file
2013-05-22 01:55:45,587 INFO [DefaultSoapUICore] initialized soapui-settings from [/home/<user id>/soapui-settings.xml]


From this information could you give us some clue what is going wrong? Feel free if you need more information from us.

Thanks.

9 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    I'm sorry to hear you're having problems with this. How exactly are you saving your responses to soapui-settings.xml? I would recommend against saving data in the settings file, and instead using either project-level properties or creating a new file (or multiple ones) for saving responses.

    Regards,

    Arian
    SmartBear Sweden
  • Liberty_Informa's avatar
    Liberty_Informa
    Regular Contributor
    Hi Arian,

    It is not that all responses are stored in the global properties. A setup project is meant to store business data in the database. We require business objects coming out of setup project to make them available at a common place, so that other soapUI projects use them. Are you saying global properties is not the right place for this type of work?

    How exactly are you saving your responses to soapui-settings.xml?

    Answer: In the setup project, once we get the response, using property transfer we assign appropriate xPath to the respective global variable. (Required number of global variables are created in the load script of the setup project)

    I would recommend against saving data in the settings file, and instead using either project-level properties or creating a new file (or multiple ones) for saving responses.

    Answer: Project property is ruled out because we want sharing (common) place for all our projects. Can you slightly elaborate how can we create multiple files? This one sounds to me exciting. What I am looking at is, how to create multiple files, where to store them, how to refer them in the subsequent projects?

    Thanks.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    There are several ways you can create files to store responses which can be used at a later stage from anywhere. For example, you could try to use DataSinks for this purpose: http://www.soapui.org/Data-Driven-Testi ... sinks.html

    Or even a Groovy script (see http://www.soapui.org/Scripting-Propert ... ricks.html and http://amadei.com.br/blog/index.php/wri ... rom-soapui).

    Save these files in a location you can easily refer to (use a global property to save the directory name, which can then be pointed at from just about anywhere in SoapUI).

    You can then refer to the saved files quite easily using a File Data Source (http://www.soapui.org/Data-Driven-Testi ... files.html), for example, or, again, a Groovy script.

    Good luck and let us know if you need more assistance,

    Renato Athaydes
    SmartBear Software
  • Liberty_Informa's avatar
    Liberty_Informa
    Regular Contributor
    Thanks Renato.

    There is lot of information in your post. I will come back to you in case any assistance is required.
  • Liberty_Informa's avatar
    Liberty_Informa
    Regular Contributor
    Hi Renato

    I am back again with my next level of question!

    I chose to use Groovy code to write my response into the file. I will again use groovy to read it later.

    I figured out how to write response to the file. However I do not want to write complete response into the file.

    For example let's say when I call getCustomert, I receive Customer data in the customer object in the response. Something like:

    <customer>

    .... <customer details>

    </customer>

    I want to store merely customer object and not the whole XML response. Essentially I want to reach to the customer object using groovy, the way we easily do that in the property transfer step using xPath.

    Can you tell me how can I achieve that?

    Thanks.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    as you are using Groovy code, then in SoapUI Pro you can:

    - open up the Groovy test step
    - Right-click in the text area > Get Data > browse to SOAP request > property[response]
    - In the outline popup choose the XML element you want and click OK
    - choose the variable name you want

    For more info please see: http://www.soapui.org/Working-with-soap ... ovy-script

    Thanks,
    Michael Giller
    Smartbear Software
  • Liberty_Informa's avatar
    Liberty_Informa
    Regular Contributor
    Thanks for this fantastic tip.

    Now I have following code in the groovy test step


    import com.eviware.soapui.impl.wsdl.*;

    def householdVar = context.expand( '${<<testcaseName>>#Response#declare namespace <<All namespaces>>}' )
    log.info householdVar

    filePath = '<<Path till where file will be created>>'
    fos = new FileOutputStream( filePath + testStepResult.testStep.label + '.txt', true )
    pw = new PrintWriter( fos )
    testStepResult.writeTo( pw )
    pw.close()
    fos.close()



    THe problem with thic code is that testStepResult is not recognised. THe error is MissingPropertyException. No such property. Please suggest what change should I make to make it working.

    Help appreciated!
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    Normally, we don't provide support for groovy code, but I can see that "testStepResult" is not defined anywhere in your groovy step. I'm not sure of what you're trying to achieve, but if you want to get the name of a particular testStep, try replacing it with testrunner.testCase.getTestStepByName("<<Name of test step>>").label.

    Regards,
    Arian
    SmartBear Sweden