Hi Remco,
Thanks for the quick response. I have read about test atomicity, and I've been careful to avoid making the tests dependent on being run together. Looking back over things this morning I see that the two tests don't actually use the exact same deployment items, but they follow the same patterns, so I still don't see why one works and the other one doesn't.
Here's the one that works:
Code:
[TestMethod, TestCategory("UnitTest"), TestCategory("BMW")]
[DeploymentItem(@"Customer\BMW\BmwLibraryTest\TestData\EVStations_GDL.xsd")]
[DeploymentItem(@"..\..\ConnectedServices\Inrix.CS\Customer\BMW\BmwLibraryTest\TestData\EVStations_GDL.xsd")]
public void GetDynamicEvDataEmitResponseXmlTest()
{
// test body omitted ... at one point in the code, though, it attempts to access EVStations_GDL.xsd without specifying any path so it expects it to be in the current dir of the test
}
And here's the one that doesn't:
Code:
[TestMethod, TestCategory("UnitTest"), TestCategory("BMW")]
[DeploymentItem(@"Customer\BMW\BmwLibraryTest\TestData\EVStations_GBI.xsd")]
[DeploymentItem(@"..\..\ConnectedServices\Inrix.CS\Customer\BMW\BmwLibraryTest\TestData\EVStations_GBI.xsd")]
public void GenerateGetBrandIconsResponseTest()
{
// test body omitted ... at one point in the code, though, it attempts to access EVStations_GBI.xsd without specifying any path so it expects it to be in the current dir of the test
}
As I'm sure you notice right away, there is something strange about the deployment item attributes: We have a system where the same project files are included in multiple solutions. Mostly we have one big solution that includes almost everything which is used by our continuous integration / nightly build system, etc. but which is so large that it is inconvenient for developers to work with most of the time, so then we have a series of smaller solutions that have coherent subsets of the overall system that encompass what someone might need to work on a part of the project. Because the solution files are in different locations, we end up having to use multiple deployment item attributes in order to deploy from different relative paths. For one solution one deployment item works and the other does not, and for the other solution the opposite. This works fine for mstest and resharper's test runner, and it also seems to work for ncrunch in one case, but not in the other.
I have worked around the problem by adding the deployed XSD file to my project and setting it to copy on build so the build system is deploying rather than the test system. Probably eventually I'll switch all of these to work that way which also removes the need for duplicate deployment item attributes, etc. But maybe this will help you locate some corner where ncrunch doesn't match the other test runners.
- Danny