mardi 17 février 2015

Excluding unit tests only on specific platform

My scenario is as follows: I'm working on a cross-platform mobile app with Xamarin.Forms. Part of this solution are unit test projects that target iOS/Android/WP8, and the tests that are executed on each platform are in a shared library.


The tests are written with the xUnit.Net framework.


Now I have some tests that succeed on all mobile platforms, but not on Windows (i.e. when I run them from within VS during development):



// in a PCL (which is referenced by platform-specific unit test projects)

[Fact]
public void SomeTest()
{
// succeeds on iOS, Android, and WinPhone
// fails on Windows (when executed from within Visual Studio)
}


I don't want to run each single test from each mobile platform during development each and every time - that would be very time-consuming. Of course, I only do that in bigger chunks.


The consequence is that I have a bunch of unit tests which fail in VS, and I cannot see if it's a 'real' error or 'only' a platform-specific problem. Rather, I'd like to see immediately what the problem is and not have dozens of red tests which I have to inspect individually.


Does anyone know how to do that?


Aucun commentaire:

Enregistrer un commentaire