We are letting you know of a few things that are happening in Visual Studio 2010 in regards to generation of Private Accesors and Code Generation.
What is Publicize in Visual Studio testing?
Publicize is the ability to take internal application programming interfaces (API) and create public counterpart API that you can call in your tests, which would in turn, call into the internal APIs of your product. This comes in the form of a stand alone executable, or can be seen when using code generation to create test method stubs of internal or private APIs.
What is Code Generation in Visual Studio testing?
Code Generation allows users to create test stubs and generates a little code snippet inside that stub. This feature can be used in conjunction with Publicize to create test method stubs from internal APIs.
What is happening in Visual Studio 2010?
We have stopped working on these features for Visual Studio 2010 and may remove them from the product in following releases. This is due to the following reasons:
- Lack of resources and time: The focus for this release has been to improve the experience for manual testers, so the priority for the code generation and publicize features has been lowered. There have also been other issues with the publicize functionality that we utilize that have not been addressed.
- New features by Language teams: As the language teams have made modifications to their project types and languages, we have been unable to respond to the changes they have made and have not been able to work with the new features they have introduced.
What is available for me then?
For those who wish to continue testing internal APIs, you have three options:
- Use the Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject class to assist in accessing internal and private APIs in your code. This is found in the Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll assembly.
- Create a reflection framework that would be able to reflect off your code to access internal or private APIs.
- If the code you are trying to access is internal, you may be able to access your APIs using the InternalsVisibleToAttribute so your test code can have access to the internal APIs.
However, there is not any good replacement for Code Generation for the new features added by the lanugage teams. You may create the TestMethod stubs and then remove the internal code. You only need to keep the stub itself.
Will it be added back in or fixed in future releases?
At the moment, there are no plans to do this. It may change based on priority and focus. Feedback welcome about this content or other items you would like us to consider for future releases.