Build/Test Issues

Copying large files using [DeploymentItem] is a race condition?

Started by otac0n on 7,299 views

About 50% of the time, I have tests failing, because one of our deployment items is very large.

This appears to be because copying the file takes longer than starting up the test engine, as we are getting a FileNotFound.

Edited

The copying of your resource file(s) is done synchronously with the test runner, so I think something else may be going on here.

Check that the tests using the file are not sequence dependent. If there is code specifically clearing out the file, you might find this can affect further test execution. A good way to check for sequence dependent tests is to run them using the Advanced->Run tests using existing process option. Make sure you also check that tests can be themselves run multiple times within the same process - this isn't behaviour that normal test runners do, and sometimes it can cause unexpected results.
This is a very large JSON file that we are using as input and expected output for one of our tests.

However, the JSON file is being loaded in the static constructor of a class that is used in the TestInitialize method.

The file is only read from, never edited or deleted.

I'll try to get a repro case.
Thanks - if you can create an isolated reproduction that would be extremely helpful. I'm not sure if this is a problem I could solve without it.

Post a reply

Log in to reply.