Forum Discussion

TvO's avatar
TvO
Occasional Contributor
8 years ago

Automate SoapUI

Hi There,

 

I wonder; is there anyway to 'Automate' SOAPUI entirely?

I mean; not only running tests, but also making them?

And besides making them, also have stuff like adding and using environments and Usernames/Passwords automatically? (for instance; make and use them for every project encountered in folder X??)

 

What i would like to do, is having a list with for example 4 colomns (Name; WSDL; Environment; Username/Password) and let SoapUI make a project for each line in that list.

Is there anyway to make this happen?

 

 

20 Replies

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi there,

     

    Yes, if I'm understanding your aim right, I would say that SoapUI projects can quite easily be created, engineered and executed programatically.

     

    These previous posts have examples along the lines of (but not exactly like) what I think you are asking about:

     

    (REST Example) http://community.smartbear.com/t5/SoapUI-Open-Source/How-to-create-REST-project-using-Groovy-script/m-p/99302#U99302

     

    (SOAP Example) https://community.smartbear.com/t5/SoapUI-Open-Source/How-to-get-parameter-of-SOAP-operation/m-p/99768#M17648

     

    Is this the sort of thing you mean?

     

    Regards,

    Rupert

  • nmrao's avatar
    nmrao
    Champion Level 3

    Let me correct first point of yours - Automate the tests using SoapUI.

    While your objective is good, too broad, you have to proceed one step ahead each time.
    Anything is possible mostly, provided you have the ideas clear, what you want, issue /problem is clear if any, with some programming skills, thurst for learning & patience.

    One point I am divert is that, creating tests automatically unless you are using data driven tests as it is more easy to create test cases in SoapUI manually than automatic (even for programmers) as it is more productive than writing code for ourself and possible introduce more bugs.

     

    To your other point regarding environment, you can use of Project level properties and use property expansion where needed. Those can also be dynamically passed to testrunner.bat/.sh (command line test execution utility provided by SoapUI) using -P <property>=<value> without even modifying existing project if environment changes. Of course, instead of passing each parameter individually at commandline, the better approach would be to use property file (one for each environment)

    • TvO's avatar
      TvO
      Occasional Contributor

      Hi There,

       

      Thanks for replying :)

       

      Yeah, it seems to me like a small step...

       

      At this moment, i make projects by adding an name, WSDL url and click Yes a cpl of times. Soapui does the rest and when its finished, all i have to do is put some values in the fields of the test case.

       

      I have to make about 60 projects in order to test every service we use. We have a lot of ongoing projects, so i have to do this frequently cause our services change a lot and i do not always exactly know which ones are altered, so best thing for me is to 'reload' the wsdl each time or to delete all projects and make new ones.

       

      So i was hoping there was some sort of batch function that reads the url from an excel list and makes the project automatically (so not filling the testcases, that i can automate another way by making them data driven, my goal atm is only making projects automatically).

       

      I now understand it can be done, but you have to use groovy or java for that (which i both don't know yet), so for now it looks like i have to do it the 'old fashioned' way..

       

      • rupert_anderson's avatar
        rupert_anderson
        Valued Contributor

        Hi,

         

        Yes, I think your assessment of the options for what you want to do is correct. Generating SoapUI projects, testcases, teststeps and assertions is very doable, and a good option, but is certainly DIY territory i.e. requires basic java or groovy, some knowledge of SoapUI objects and patience. If you want to work on this, I'll try to help you where I can, just start small and build up.

         

        Just for completeness, its maybe worth mentioning that, once generated, SoapUI persists its objects as XML in the project file, as you may be aware. Some people also copy/paste/replace a copy of the project file xml using a standard text editor and thus build up the project structure they need this way - it can work too - but, I have generally only done this for tweaks, but others may have done it on a larger scale!

         

        Good luck with it and let me know if you need any scripting advice,

        Regards,

        Rup

  • ratima29's avatar
    ratima29
    New Contributor

    Is DELETE method allowed in SOAPUI open source tool?

     

    I am facing this error.

     

    HTTP/1.1 405 Method Not Allowed
    Date: Tue, 04 Apr 2017 11:42:07 GMT
    Server: Apache/2.2.15 (CentOS)
    X-Powered-By: PHP/5.6.30
    Allow: GET, POST
    Content-Length: 0
    Connection: close
    Content-Type: text/html; charset=UTF-8

     

     

    • rupert_anderson's avatar
      rupert_anderson
      Valued Contributor

      Hi,

       

      I think the DELETE method was certainly OK last time I tried.

       

      Is it not that the Apache sever on your CentOS box only has GET, POST methods allowed? This can be quite common for historical reasons.

       

      Thanks,

      Rupert

    • nmrao's avatar
      nmrao
      Champion Level 3
      It is recommended not to cross post. Please open a separate topic for this and no need post in the unrelated topic.
  • zen_paul's avatar
    zen_paul
    Occasional Contributor

    Looking at what you want to do, using something like Jenkins to kick of a specific test or set of tests might be useful. We have several projects that we run using Jenkins, both kicked off manually or kicked off according to a schedule. It's pretty easy to do and can be set up so that the tests are running in their own workspaces, and thus isolated from each other from running the test point of view. 

     

    Thus you don't need to create the test projects each time, the test projects are defined once in SoapUI, but you just choose the test project you want to run from an existing list of test projects. Might mean you need less groovy skills to programatically create SoapUI projects on the fly.

     

    Just a thought and a different approach that might meet your needs.

    • TvO's avatar
      TvO
      Occasional Contributor

      Hi There,

       

      Sounds Ok, that Jenkins and i will definatelly look into it. It might be usefull for me in future, but its not what i want to do at this moment..

      What i want to do is make the projects, testcases and teststeps  every time i need to do my regression tests so that i don't have to keep track of every single alteration in the wsdl's.

      Its supposed to become a time saver.

       

      For this moment all i have to know is what groovy command i need to use to close project A and open project B. If i know that, then i can try (its all try and error atm) to get a step further...

       

      The steps that i want to follow are:

      1: automatically make projects 

          1.1 automatically fill some environment variables like different environment url's, different usernames/passwords, etc

      2: automatically make testcases

      3: automatically make teststeps

      4: automatically fill the teststeps

      5: run tests automatically and get a report

       

      Step 1 is working (not 1.1, i will save that for later)

      Step 2 isnt atm.

      Step 5 is covered, i know how to do that

       

       

      • TvO's avatar
        TvO
        Occasional Contributor

        Ok, i managed to do steps 1 and  2

         

        Atm i am really struggling with adding SOAP teststeps from the WSDL.

        I have several operations in the WSDL, lets say: Create, CreateOrUpdate, Delete, Retrieve, etc.

         

        Now i need to make 1 teststep for each operations in the wsdl automatically.

         

        Does anyone know how to let groovy read the wsdl and make a teststep for each method found?

         

        I am working with the following:

        Project Test

        Suite: Testsuite 1

        Case: Testcase 1

         

        Teststeps? (to be made)