
NET Core projects, you can configure xUnit with an file, as documented at. To make it sequential you just need to put both the test classes under same collection: namespace IntegrationTestsįor. In xUnit you can make following changes to achieve this:įollowing will run in parallel: namespace IntegrationTests

Hosting each service endpoint only once is also the proper behavior.however, it is not particularly conducive to unit testing.Įach test class is a unique test collection and tests under it will run in sequence, so if you put all of your tests in same collection then it will run sequentially. I don't have the ability to change its behavior. NOTE: ServiceHost is a WCF class, written by Microsoft.
MULTIPLE TESTING VS SEQUENTIAL TESTING HOW TO
I am hoping that someone here on SO has encountered a similar issue and knows how to get unit tests to run serially. I have used xUnit.NET, hoping that because of its extensibility, I could find a way to force it to run the tests serially. Because of the fact that modern unit testing platforms parallelize their test execution, I have no effective way to unit test this piece of code. If a ServiceHost has already been created, opened, and not yet closed for a particular endpoint, another ServiceHost for the same endpoint can not be created, resulting in an exception. I have run into a difficulty in unit testing this host management engine, however, due to the way ServiceHost works. This allows us to dynamically reconfigure which services are available without having to bring all of them down and restart them whenever a new service is added or an old one is removed. The engine basically creates ServiceHost instances on the fly based on configuration.

I am attempting to unit test a WCF host management engine that I have written.
