0

I am testing a SOAP service using a client generated in VS2010 via "Add Service Reference".

I am running tests in parallel (c. 10 threads) and this has exposed some DB locking issues in the system under test. However, this is not going to be fixed straight away and I don't want my functional tests failing due to this problem.

As a result I have reduced by test threads to 1, and as expected I do not see the locking issue, however, this obviously makes my test suites a great deal slower. Therefore I was wondering if it is possible to use client configuration to restrict the client to only make one request concurrently?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Robbie Wareham
  • 3,380
  • 1
  • 20
  • 38
  • I'm unsure how you would think that that would make anything faster? – Peter Ritchie Sep 03 '12 at 14:46
  • Could you maintain a queue of requests and process them sequentially? – Phil Lambert Sep 03 '12 at 14:53
  • The tests are written in MbUnit and uses the DegreesOfParallization attribute to run multiple threads and improve test suite run time. They are functional tests which treat the SOAP service as a blackbox end point. Each test has to make a series of calls to create data and make assertions. I cannot change the SOAP service to handle the concurrent requests better (although that is now on the back log). My idea was that if I restricted the SOAP client to a single thread, the tests woudl still run in parallel but obviously not as fast as if teh SOAP service could handle concurrent requests – Robbie Wareham Sep 04 '12 at 09:42

1 Answers1

0

Its not the soap client that needs to be restricted its the calling code. A Soap call will be performed in which ever thread it is being made from. If you have a problem with multiple threads this is because you have multiple threads in your code, or you are trying to make additional service calls or updating something in a callbacks without understanding what thread you are in.

Depending on the problem you have many solutions which could include:

  1. Remove the multi-threading from your application, don't use callbacks and don't fire up additional threads.

  2. or ideally Make sure you dispatch back to the UI when appropriate, understand which thread you are in so you fix the underlying locking problem

http://msdn.microsoft.com/en-us/library/ms591206.aspx

    Me.Dispatcher.BeginInvoke(Sub()
                                  ' This will be executed on the UI Thread
                              End Sub)

It would be nice (and very useful) to have the code in question..... in your question. Which version of .net your using and what your app is written in (Asp.net, WinForms?) would also help get some context.

NB: Sample code in vb.net but you get the idea ;p

JonAlb
  • 1,702
  • 10
  • 14