Forum Discussion

cancan's avatar
cancan
Occasional Contributor
12 years ago

Creating log files from mock service

Hi everybody,

we are trying to test a tool with the help of soapui. When I send a message from these tool, I can get back answer from the mock service.
However I cannot save or create these log files with request or response in my computer, what I mean is, that the created log files are empty

I have done in OnRequest Script till now:

def timestamp = System.currentTimeMillis()
def directory = "c:\\dump"
def requestFile = new File(directory, "request_${timestamp}.xml")
context.requestContent = context.expand( context.requestContent )
requestFile.write(context.requestContent)

CAN YOU PLEASE HELP ME?

ps: mockRequest or messageExchange are not accepted in OnRequest or AfterRequest Script!

4 Replies

  • cancan's avatar
    cancan
    Occasional Contributor
    Hi Michael,

    thank you for your posting.

    The flexibility that I need is to execute operations like creating log files from mock service or assertions without any testSuite, testCaseResult or testStep etc. objects.

    Because we are trying to use all SoaPUI feature without creating a testsuite, which is much more user friendly for the customers. What I mean is for ex.
    after entering some value in a user interface of a programm and clicking on "send", the mock service is able to answer and also to do all assertions.

    Do you have any idea about it?

    Thanks for your time and knowledge

    Can
  • Hi Can,

    The assertions are only made to work on functional testing side where users are making requests.

    If you are trying to validate and log data coming into the mock service on the fly, you should be able to script that with a event filter (http://www.soapui.org/Scripting-Propert ... dlers.html) for "MockRunListener.onMockRequest"

    Thanks,
    Michael Giller
    SmartBear Software
  • cancan's avatar
    cancan
    Occasional Contributor
    Hi Michael,

    thank you for your useful aswer

    Best Regards
    Can