NUnit validation process often fails with WPF controls

We have a NUnit test project with 1000 tests or so. The project contains a high-level component test primarily for the WPF user control. The testing process often fails on our build server (TeamCity) with:

InvalidOperationException "LocalDataStoreSlot local storage has been freed"

mscorlib.dll! System.LocalDataStore.GetData (slot System.LocalDataStoreSlot)

mscorlib.dll! System.Threading.Thread.GetData (slot System.LocalDataStoreSlot)

WindowsBase.dll! System.Windows.Interop.ComponentDispatcher.CurrentThreadData.get () ...

Tests contain the attributes [RequiresSTA], Window.Show (), Dispatcher, etc., so it is definitely not a regular unit test project.

The error looks completely random, we have a version where it occurs with a probability of 80%, but most of the time this does not happen at all. Absolutely cryptic, sometimes simple changes in production code, such as changing styles in xaml code, start to fail, then the next change in production code fixes it.

This random accidental failure makes our development team very upset, our advanced build system is seriously complicated by this failure.

We could very rarely play it locally, starting the project with nunit-console.exe.

Have you ever seen such a failure of the testing process? Any tips on how to solve this problem would be much appreciated.

thanks

+5
source share
1 answer

We encountered the same problem in our environment (Jenkins, Windows 8, NUnit 2.6.3).

These measures have fixed this for us.

  • Make sure NUnit is not running under .NET 3.5 or earlier. This post explains how to do this.
  • Work around a NUnit crash on shutdown using the NUnit runter /nothread command line option. If you use MS Build Community Tasks , you need to set the TestInNewThread attribute of the TestInNewThread task to false .

Some background information on the nature of the failure can be found in this MSDN forum forum . In the end, this needs to be fixed in NUnit.

+1
source

Source: https://habr.com/ru/post/1205356/


All Articles