简体   繁体   中英

Unexpected behaviour from load test

I have a load test which contains only a single unit test.

The unit test is of a function in C# which calls C++ code using C++/CLI wrapper.

It runs well without any exception.

The projects are

1)Business logic ->BusinessLogic.lib

2)Wrapper(takes Business Logic.lib)->Wrapper.dll

3)C# project(takes Wrapper.dll)

The load test on running says that Wrapper.dll is not found whereas the full application runs properly and even unit test doesn't report any such error

The exact error is

Test method TestProject1.testTest.getstateTest threw exception: System.IO.FileNotFoundException: Could not load file or assembly 'ManagedBL.dll' or one of its dependencies. The specified module could not be found

where TestProject1 is the Test Project,testTest is the Test Class and getstateTest is the unit test

Is your load test part of a testing framework (NUnit et al) or is it part of your application?

If the load test is inside a testing framework, then check that the Wrapper.dll gets copied into the "staging" folder where the test framework outputs the DLL and executes the test. Furthermore, please specify exactly what the error message is when you run the load test.

Update

OK, so there are several things that could cause this issue:

  1. Visual Studio does not copy the ManagedBL.dll into the test staging directory.
  2. Visual Studio does not copy the BusinessLogic.lib into the staging directory.
  3. Visual Studio does not copy some other library dependency used by the BusinessLogic.lib (ie is the BusinessLogic.lib linking into any other native libraries?)

Technically, VS should copy the ManagedBL.dll if you have added it to the C# project's references; however, do check that it gets properly copied anyway (should be in the TestResults folder).

To fix 2 and 3 you might have to do something like this: How to copy native libraries to the unit test staging directory in Visual Studio 2010

Finally, if all else fails, I would highly recommend that you get the Process Monitor and run it while your test is loading and use the filters to only show the information relative to your test process. Process Monitor should be able to tell you when your process fails to find a file/library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM