royboy23;8243 wrote:
I guess the only way to achieve this is by using the serial attribute and also adding a capability to only one of the nodes that that the test is supposed to be using. Or is there any simpler workaround?
Using SerialAttribute with RequiresCapabilityAttribute is the quickest and simplest way to implement this. Unfortunately, it would mean targeting the tests to a specific node, but you likely would receive little benefit from the parallelisation or distributed processing if these tests have a central dependency anyway.
It may be worth using ExclusivelyUsesAttribute instead of SerialAttribute if you have other tests that are able to run concurrently with these database tests. It would be painful to wait for your database tests to finish before any unrelated and unrestricted unit tests could be run.
I recommend examining ways to tweak your test code to remove the concurrency constraint. One possible option could be to have a separate database or schema per grid node, so that the nodes wouldn't be restricted by access to only one database. You could derive the connection string using some parameter on the grid node, like System.Environment.MachineName for example. This would give you significantly higher throughput and better response times from the engine - assuming the database server can keep up with the demand.