Why does the MSTest accessor file contain a "desktop" reference - mstest

I am using VS2010 to create a new unit test project to test my solution. After I created the unit tests, the VS created a .accessor file. I know it is used to help test the private or protect members. But I opened the .accessor file, I found the file contain two line text, just like below format:
MyProjcet.dll
Desktop
I don't know why the Desktop reference is there?

According to the thread Best practices trying to use the same unit test on desktop & device:
It explains that this is a setting for a Desktop device (rather than a mobile one)

Related

How to launch and get the results from another application using an application in visual studio?

Well, I am developing an application and it needs results from another application. This secondary application is a full-fledged application and is independent. So, is it possible?
Thanks in advance.
Edit: It's an entirely different application. Still, I know that secondary application writes content at a particular application and that's all I know. As for the calling application, is it really possible to just call the installed application present in the system? WinHttptrack website. I need to call that application and store the written files somewhere and these files should be accessed in my visual studio application. This is my requirement.
Second edit: I can use process. start from the system diagnostics, to start my desired application but it needs a manual input of project name, url and such. How am I supposed to pass them?
References are useful for example building a test app that validates a different projects(each project is technically its own application) local data within Visual Studio.
https://msdn.microsoft.com/en-us/library/wkze6zky.aspx
Alternatively you could consider exposing the data in some format such as .json or xml to share data between the apps or even look at employing a database driven system
You may also want to consider taking a look at Entity Framework:
https://msdn.microsoft.com/en-us/library/gg696172(v=vs.103).aspx

How to set runtime parameter from NUnit GUI?

Currently I am working on a large scale refactoring task where WinForms controls are affected. So practically I would like to change 3rd party controls with our custom controls. I extracted an interface from the 3rd party component, and now I am implementing our custom controls. I wrote tests against the extracted interface, and created a bunch of unit tests which runs against both the old implementation (the 3rd party one) and the new implementation.It would be fine for me if I could use some runtime switch for the tests. What I mean is that I d like to call ShowDialog() at the end of the tests to provide visual feedback on what I did. It would be strictly an option for the developers. Obviously on build servers it would be not used at all.
Is there any way to do this with NUnit? Can I provide runtime parameters on NUnit GUI?
Yes you can. If you run nunit.exe /? you'll see the list of options you can pass to the GUI executable.
NUNIT-GUI [inputfile] [options]
Runs a set of NUnit tests from the console. You may specify an assembly or a project file of type .nunit as input.
Options: /fixture=STR Fixture to test
/include=STR List of categories to include
/exclude=STR List of categories to exclude
/config=STR Project configuration to load
/noload Suppress loading of last project
/run Automatically run the loaded project
/runselected Automatically run selected tests or all tests if none are selected
/console Create console display for viewing any unmanaged output
/lang=STR Language to use for the NUnit GUI
/cleanup Erase any leftover cache files and exit
/help Display help (Short format: /?)
In regards to providing feedback to developers, I would suggest using /console and sending output to Console.WriteLine() instead of using ShowDialog(). Hope this helps.

Run Custom Tool at build in VS

I'm creating an internal VS template to create new versions of a multilingual website with custom fields filled by a wizard. All is going well, until I try and run the program. Upon running, I receive...
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "<My Namespace>.Global.resources" was correctly embedded or linked into assembly "<My program>" at compile time, or that all the satellite assemblies required are loadable and fully signed.
If I open up the resx files and save them, or choose to run a custom tool before building, it works fine, but if I try to build immediately after creating the project, I receive that error.
My settings on all of my resx files are...
Build Action - Embedded Resource
Copy to Output Directory - Do not coopy
Custom Tool - PublicResXFileCodeGenerator
Custom Tool Namespace - <My Namespace>
Mostly, I'm just looking for a way to run the custom tool at build. This does need to work as I've described it. This is a large company, and non-programmers/non-experts work here.
Thanks in advance,
Andrew

What's "Local.testsettings" and "TraceAndTestImpact.testsettings" files that Visual Studio create when init a new test project?

When create a new test project using visual studio these 2 files are created, what's the purpose of these files? If to run the tests using Visual Studio, these files apparently is not needed.
Local.testsetting mainly used to define your test attributes. Lets assume you have set of test cases that you want to execute using a remote controller machine that you can configure in 'Host' section in this setting file. Also there are multiple other test attributes like 'TestTimeout: to set specific timeout for all your test cases, 'Setup & Cleanup Script': if you wish to run some script before running any test and after all your test cases executes. You can take this file as a Global setting file for your all test cases within this test project.
There will be another file with extension .VSMDI. This file contains list of test cases within this test project. And you can group test cases using this. For example, lets assume you have set of test cases that you want to integrate in your automatic build system and you have some other test cases (Like something opening a browser and check for some element) that you don't want to integrate with your build system. So can do all this grouping using this .vsmdi.
-Thx

Brief "run-down" on setting up Unit Tests in Visual Studio 2008

I am forcing myself to learn test-driven development, and so far I'm enjoying myself. There's a few quirks that Visual Studio Unit Testing has that is driving me batty though. A bit of background information, my project folder looks like this:
[Root] BitFlex
BitFlex\Code
BitFlex\Debug
BitFlex\Documents
BitFlex\Release
Now of course all the source code is stored in the code folder, and on a build the project output either goes to the debug or release folders depending on the current configuration. Now for my unit testing, I have it setup so the test project is output to either:
BitFlex\Debug\Unit Tests\
BitFlex\Release\Unit Tests\
1) At this point, everything is fine and dandy. There are two problems with this, the first being that when I run a test it cannot find the assembly, as it gives me this error:
Error AssignDefaultProgramTest BitFlex.UnitTests The test assembly 'D:\src\DCOM Productions\BitFlex\Code\TestResults\David Anderson_DCOMPRODUCTIONS 2009-07-31 23_21_00\Out\BitFlex.UnitTests.dll' cannot be loaded. Error details: Could not find file 'D:\src\DCOM Productions\BitFlex\Code\TestResults\David Anderson_DCOMPRODUCTIONS 2009-07-31 23_21_00\Out\BitFlex.UnitTests.dll'.
I cannot seem to find information on this error, or how to resolve it so I suppose that's where everyone's experise around here comes in to play.
2) My other beef is that Visual Studio generates the "Test Results" folder in my code directory, I would prefer to move that to my Unit tests folder in either output configuration. Is there a way to do this, or a better practice to setting up a well organized Unit Test using my folder hierarchy?
By default MSTesting framework runs all tests in an 'isolated' location and not from the binaries directory.
To fix this you can do one of these two:
1. go to the test configuration file and under deployment uncheck deploy the tests.
2. don't use path when looking for external files instead use deploy attribute or the test config to deploy the needed files along with your tests.
For doing TDD with MSTest, turn off deployment. You shouldn't need it for "unit testing."
Also, never ever EVER have VS automatically generate tests for you. What's generated may be fine for some types of functional testing, but are usually very poor unit tests.

Resources