Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Team Build: Cannot find generated private accessor

We have been using TeamBuild and test for our continuous integration build for about 4 months and this issue just popped up the other day in one of our test assemblies when running tests on one of our test assemblies on the build server only.

{NameSpace}.Order_Accessor, Version=0.0.0.0, Culture=neutral, PublicKeyToken='{xxx}' or one of its dependencies. The system cannot find the file specified.

This is not being caused by problems with Publicize.exe noted elsewhere. The unit tests run fine locally and the generated assembly does get created.

The part that is confusing is that we use generated private accessor assemblies in numerous projects including the one with this issue above without any problems. Investigating this issue further, the generated assembly never gets copied to the TestResults//Out directory which appears to be the problem. I determined this was the issue by adding the assembly from SolutionRoot using the TestRunConfig deployment settings which results in an assembly manifest does not match error.

I am wondering if anyone has had issues with these assemblies being copied properly. We are running TeamSystem 2008 on Windows Server 2008 if that helps.

Below is the test run deployment error for the file in question as well Run has the following issue(s):

TESTTOOLSTASK : warning : Test Run deployment issue: Failed to get the file for deployment item 'E-mail Templates\OrderConfirmation.txt' (output directory 'E-mail Templates') specified by the test 'EmailServiceTest.EnqueueTest': System.IO.DirectoryNotFoundException: Could not find a part of the path 'Continuous Integration Build\Binaries\Continuous Integration Test\E-mail Templates\OrderConfirmation.txt'.

TESTTOOLSTASK : warning : Test Run deployment issue: Failed to get the file for deployment item 'E-mail Templates\OrderConfirmation.htm' (output directory 'E-mail Templates') specified by the test 'Email.Tests.EmailServiceTest.EnqueueTest': System.IO.DirectoryNotFoundException: Could not find a part of the path 'Continuous Integration Build\Binaries\Continuous Integration Test\E-mail Templates\OrderConfirmation.htm'

TESTTOOLSTASK : warning : Test Run deployment issue: The assembly or module 'Services.Order_Accessor' directly or indirectly referenced by the test container '\continuous integration build\binaries\continuous integration test\services.order.supplierintegration.tests.dll' was not found.

like image 791
mkedobbs Avatar asked Jan 20 '10 16:01

mkedobbs


People also ask

Is Mstest deprecated?

Test projects that are Coded UI tests or Web Load Tests are not compatible with MSTestV2. These project types have been deprecated.

Should we test private methods C#?

Private methods are usually not designed to be called externally. Therefore, it is not an efficient use of your time, and tests will be brittle. You will be wasting time testing private methods because they contain the implementation of your object rather than its public interface.

Which annotation identifies the method that is called just once after the last test in TestClass in Mstest is executed?

@After annotation is used on a method containing java code to run after each test case.

How can we test non public methods in C#?

You can use this. GetInt() or even simply GetInt() from within the class to call the private method. Again, if we attempt to call it from a test (or anything outside the class), your code will fail to compile. This is what a private method does by definition.


1 Answers

Looks like your TestRunConfig deployment expects that the files are in "Continuous Integration Build\ Binaries\"

I've highlighted the "Binaries" part for a reason. This is a folder the $BinariesRoot property points to (unless overridden), and it is used by the compiler. Therefore, I'd suggest you double-check that:

  1. The Publicize tool (or whatever tool you use to generate the assemblies) is configured to copy the output into ($BinariesRoot)Continuous Integration Test
  2. There are provisions in the team build type to copy the .htm and the .txt files to ($BinariesRoot)Continuous Integration Test
like image 176
DmytroL Avatar answered Oct 02 '22 20:10

DmytroL