Forum Discussion

dschweie's avatar
dschweie
New Contributor
14 years ago

MockService: How to anser a request with special HTTP status

Hi,

first I have to say that I really like soapUI. I use MockService for testing client software.

I would like to answer a request with another HTTP status code than 200. I already used script inside response. Here you find my snippet:

mockResponse.setResponseHttpStatus("401")

In dialog "MockResponse Properties" I can observe the value 401 in property "Response HTTP-Status"

After sending a request to MockService by jMeter I always see "Response code: 200".

Could you please give me a hint? Thanks in advance.

Best Regards
Dirk O. Schweier
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Dirk!

    I just tested with soapUI 3.6.2 nightly build and it works just fine. Could you please send your project to support@eviware.com?

    (I find kind of strange that you use an external load testing tool (JMeter) to functionally test a soapUI mock service. Functional testing is probably the single area where soapUI shines the most.)

    Best regards

    /Henrik
    eviware.com
  • dschweie's avatar
    dschweie
    New Contributor
    Hi Henrik,

    thanks for your answer.

    It is not a question that I do not trust in soapUI and its functionality. In my case I set up a MockService as a testing tool for client software. Whenever I have to insert scripts or code into test tools I am very strict regarding validation of these tools. So, by using another tool I think I avoid side effects.

    But okay, I will never again call another tool by name. I just talk about another tool.

    In my post I really forgot to mention that I am using soapUI 3.6.1. Sorry for that. I think I will stick to this version because using a nightly build should cause some trouble regarding configuration management in our project. We have to make sure that every tester uses the same snapshot.

    I am looking forward to read your answer on my mail to your support account. Thanks in advance.

    Best Regards
    Dirk O. Schweier
  • ozbobwa's avatar
    ozbobwa
    Occasional Contributor

    [SoapUI 5.5.0] uses:

     

    mockResponse.setResponseHttpStatus(401)

    without the quotes