Forum Discussion

mmoser18's avatar
mmoser18
Frequent Contributor
5 years ago

Script to start mocks on a single click?

Hi all

In our project file we have defined a couple of "surrounding" systems and also defined mocks for these, so that we can test our application even in absence of these systems.

 

I am now seeking a possibility to start ALL these mocks (we have about 10 of them) with one click, because the process to right-click on each of them and select "start minimized" is a bit tedious (to state that friendly).

 

Now - I am aware of the LoadScript option (as described e.h. here: https://community.smartbear.com/t5/SoapUI-Open-Source/Start-mock-service-on-SOAPUI-startup/m-p/4462#M2242), but in our case we do NOT want to automatically start these mocks each time we load the project (and esp. we don't want to start them "headless", i.e. without any optical clue that they are running which IMHO is a major design flaw of that feature!).

Is there a possibility or some suggested location to have that script stored somewhere within the project so that one can trigger it manually when needed but NOT have it executed automatically at startup?

  • nmrao's avatar
    nmrao
    Champion Level 3
    Didn't understand the design flaw thing which you stated.

    You may consider running it in tomcat by deploying a war file(SoapUi can create war file). So it will be one click or run it by one command.

    Other option, though haven't tried, is to run the project in command line testrunner utility. You may have enable the option start on start up.

    So better would be(either war deployment or runn command line) to have a copy of the SoapUi project and remove the test suites and save it with different name. This can work well for your need provided no frequent changes to mock services.

    When war deployed or run from command line, you can see the console to know what's happening or check log files.
    • mmoser18's avatar
      mmoser18
      Frequent Contributor

      Hi Rao

      thanks for responding.

      From your misc. suggestions I conclude that there is no easy way to have a multi-project workspace (one that contains multiple projects each having a series of mocks) and start the mocks contained in ONE of these projects without going through them manually.

      That wouldn't be a big issue if one could start multiple instances of SOAP-UI but that's not so trivial, either. So we tend to have workspaces that contain multiple projects. And if more than one of them has an autoLoadScript interesting things can happen...


      With the "design-flaw" I meant that when a LoadScript starts a series of mocks than there is NO visual clue (other than in the log-file) that any mocks were started and are running. 

      In our case this lead to the problem that someone had loaded TWO projects but hadn't even been aware that one of them contained a load-script that started mocks automatically.

      So he manually started the mocks of the other project and - as since there was no indication that there were already mocks running from the first project (which happened to use the same port and partially also the same method names) - he was VERY surprised by the responses that his application got from "his" mocks. Their response matched NOTHING that had been defined in the mocks he had just started manually.

      Had these mocks also created minimized windows (as mocks do when you manually start them minimized) it would have been obvious that there was already something running here (and one would also have a chance to stop these, which is also not possible with mocks auto-started by a load-script). So - as nice and convenient this feature is -it can lead to big confusion! Hope I could make myself clear...

      • nmrao's avatar
        nmrao
        Champion Level 3

        How would you know if the original service is running or not when you want to hit the real service?