Unit Testing in Parallel

Need some guidance on running unit test in parallel. I am trying to write BDD tests to validate the behavior of service endpoints. Servicestack Host is a singleton per APP Domain so I can’t leverage parallel testing and get this error:

ServiceStackHost.Instance has already been set (WorkloadsHost)

Any thoughts on solutions / alternatives if any other than “run sequentially”?

You can’t run any unit tests that requires a configured AppHost (e.g. self-host integration tests) in parallel, there can only be 1 AppHost which should be disposed at the end of every test fixture.

Any solution cannot involve trying to configure more than 1 AppHost within the same App Domain. Some potential solutions that don’t violate this include running against external test servers, i.e. your clients tests are calling external web hosts (i.e. in a different process) launched before your tests are run. Another solution could be splitting tests into different test projects so that 2 different build agents can run them concurrently.