I have a series of tests that I execute for work. Occasionally, an entire set of tests will start failing while others around them function. And then they'll work for a few runs, then start failing again. The key place of failure is in the Initialize function in our PIWrapper.Configuration.TestConfig class:
/// <summary>
/// Automatically initialize the context from the App.Config.
/// </summary>
public static void Initialize()
{
// For the purpose of the unit testing use the library App.config
// instead of the default App.Config of the unit test engine.
Config.CustomConfigFile = Assembly.GetExecutingAssembly().Location;
//Initialize(@".\DIConfig.xml");
// Initialize dependency injection using the source specified
// in the library App.config file.
DIContext.Initialize();
}
The error I'm encountering is that occasionally a project will decide that its executing assembly is not in the location of "C:\PI.FuncTest\bin\PIWrapper.dll", but rather in "C:\PI.FuncTest\TestResults\Deploy_sduggan 2016-05-24 11_41_02\Out\PIWrapper.dll", the location where the Specflow test results are logged. When this happens (which seems random), all of the tests in the test-file will exhibit this behavior 9 times out of 10 (the tenth time, it will pick the correct assembly location) while tests in the same project, but different files, run just fine.
I have tried deleting the contents of the TestResults directory on the off-chance something left behind was causing the problem, but that availed me not. Because it's company code, I'm limited in what I can post, but I will try to post what I can to get this problem solved. Thank you.
Aucun commentaire:
Enregistrer un commentaire