madoxdev
madoxdev

Reputation: 3890

Specrun - delay of threads

I have a tests written in c#, I am using SpecRun version 1.5.2.

Part of my Default.srprofile looks as follows:

<Execution stopAfterFailures="20" testThreadCount="5" testSchedulingMode="Sequential" retryFor="Failing" retryCount="3" />

There is a bunch of tests that are using some data from the db, so the tests are creating that data first. Unfortunately when 5 threads are running parallel, I am occasionally getting a sql deadlock error which is fine, as those threads try to write data in same time.

Is there any chance to add a delay of thread execution? Something to say than threads should start within 5s seconds interval or something similar?

Upvotes: 0

Views: 832

Answers (2)

Vladyslav K
Vladyslav K

Reputation: 21

In addition to previous answer, if you go with catching deadlocks and retries, I'd also add some random time interval between attempts so that you don't get the same deadlock on each retry iteration. We do that for API/DB concurrent requests and it works fine for us, since multiple databases/environments would require more resources and money to be involved.

Upvotes: 1

Andreas Willich
Andreas Willich

Reputation: 5835

There is no option for a delayed start and I wouldn't go with this idea. It is only a quick fix. You will get this error again when later test are executed simultaneous.

2 options to fix your problem come to my mind:


Full Disclosure: I am one of the developers of SpecFlow and SpecFlow+.

Upvotes: 2

Related Questions