Wednesday 6 March 2019

How to disable xunit parallel tests?

Why would you want to run your tests in a single thread?

In my case I was doing integration tests which involved provisioning and destroying CosmosDB databases and collections. Obviously if one thread destroys the database while another is relying on it, then tests will fail.


So here is how to force xunit to run in a single thread:

1. Create a file in the root of your Visual Studio project named: xunit.runner.json

2. Ensure it's properties are set to "Copy to output directory".

3. Add the following:
{
    "parallelizeTestCollections": false,
    "maxParallelThreads": 1
}

4. Now build your project, and run: dotnet test


Dang Easy!

More info here: https://xunit.github.io/docs/configuring-with-json.html


Saturday 2 March 2019

Cannot close Start Window on Visual Studio 2019 for Mac - How to close it!

This is a painful bug.

Even though you can click the window, you can't close it.

Here's how to close it:


This brings the window back into focus so you can actually click on it and use the close button!






That's it! I hope they fix this.