Running one test on a remote test controller/agent - visual-studio-2010

I have unit tests set up to run on a build server. I just added a codedUI test which isn't running because I need to set the controller to run in interactive mode. Because we couldn't alter the existing build controller, we set up a machine with its own controller/agent combo.
How can I, within visual studio, tell one of the tests (coded UI) to run under this controller/agent, while keeping the others as they are? I looked into testsettings files but it's not clear how I can get this done.
The controllers/agents are 2010, I'm on vs2012.

First, you have to configure your controller to run with Visual Studio. So, open the Test Controller Configuration tool and check that the Register with Team Project Collection option is not selected.
Then, from visual studio (2012):
Right click on the solution and select add new item. Add a new Test Setting file.
In the Test Settings window go on the Roles tab. Select Remote Execution and add the controller's (machine) name or ip in the Controller field.
After you saved your settings, select Test --> Test Settings ---> Select Test Settings File and select your new settings.

Related

Including additional files when publishing an app with Visual Studio 2012

I have a console application that I've been developing and I'm just about ready to publish it for consumption.
However, there's a file that the app needs to reference (a couple files actually) and I'd like to try to include these either during install logic or via an outside process. Here's the situation:
The application fires off a load test based on some criteria the user chooses. The load test is defined by a .loadtest file which is created outside of this project.
So what I would like for the installer to do is contain the .loadtest files and just shove them in a default directory that the project can reference.
I can't figure out how to add this specific file as a pre-requisite or anything though, in the publish wizard. Any ideas?
When you add a file to the solution, it does not automatically get attached as part of the build in some cases. If you right click the file in your solution explorer and select "Properties", change the build action to "Content". This will ensure that VS includes the file as part of the build/publish and places it in the output directory of the build process.

Visual Studio 2010 How to stop Change of Execution Path when running a Test

I am trying to test an application which loads an assembly during processing and parses files using the contained information. The problem is while I have the path from where the assembly should be loaded from, to point to my test projects bin folder, what ends up happening is when the test starts running, it runs from a different location that is dynamically created(I believe) by NUnit. How do I force the test to use the local test projects bin path I have set up?
Using this, I am able to access the execution path below, which is not what I want.
System.IO.Path.GetDirectoryName( _
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
file:\C:\XXXXDEV\XXXXXXXXXXXXXXXXXXX\TestResults\LX####S1Z 2013-03-15 09_44_19\Out
I would rather it point to the Test Projects own local folder where the dlls that I want loaded are found.
C:\XXXXXXXXX\XXXXXXXXXXXX\XXXXXXXXX.Watcher.Test\bin\Debug\XXXXXXOutputXXXXX.dll
I selected Test(menu) > Edit Test Settings > Local(local.testsettings) to open the test settings window. I then scrolled down to select the Unit Test option to the left of the window. To the right of that, I browsed to select my test projects /bin/Debug folder as the Root folder for the assemblies to be loaded. And then I checked the Use the Load Context for assemblies in the test directory checkbox. Click Apply and then Close. After this, when I run my test, the assemblies loads correctly.

How to automatically regenerate DB partial project files?

I am using advanced version of Visual Studio 2010 and using database projects. There's a feature of exporting database schema as partial project (which creates *.files output file), but it is triggered manually by the developer (you need to right-click on the project and select Export as partial project). I would like to automatize this process, meaning that the output file is created each time I modify the database, I build it OR I close the solution.
I tried creating a macro, which executes a DTE command Project.VSDBExportAsPartialProject, but sometimes it fails with an exception AND it shows a Save as dialog box, which I would like to avoid. Maybe the idea is to add it to the post-build event, but I don't know how to execute DTE commands from there.
To sum up, all I need is to automatically refresh the *.files output file located in fixed path without any user interactions.
Is it possible?

Cannot find any coverage data (ASP.NET MVC2)

I am having some issues with getting Code Coverage working with an out-of-the-box ASP.NET MVC2 Web App
VS2010 Ultimate, File > New Project > ASP.NET MVC 2 Web Application > Yes, Create unit test project with Visual Studio Unit Test. I then Rebuild All, Run All Unit Tests, Go to Code Coverage and get the following message:
Cannot find any coverage data (.coverage or .coveragexml) files. Check test run details for possible errors.
All the unit tests passed. (And I haven't touched a line of code yet)
I did find the following on the web:
http://www.vbforums.com/showthread.php?t=615377
which says to do the following:
Test -> Edit Test Settings -> Local
In the test settings dialog, click
"Data and Diagnostics" Ensure "Code
Coverage" are checked, and
double-click on it Check of the dll's
you want code coverage enabled for.
But, when I go to Test > Edit Test Seetings, all I see is the grayed out menu item stating "No Test Settings Available".
Any ideas?
Edit: slowly gaining traction. See: How to create the vsmdi/testrunconfig file when importing a Visual Studio test project?
I have had this same problem occur when I added a test project from another source (ie added to, but not created in the current solution). When doing this, local.testsettings, Solution.vsmdi, and TraceAndTestImpact.testsettings are NOT created inside your solution.
This fix is really quite simple, though. Simply right click on your solution and click Add -> New item. A new window will appear. On the left-hand side under General and Performance should be Test Settings. This should let you add a .testsettings file that you can now edit.
More information can be found here:
http://msdn.microsoft.com/en-us/library/ee256991%28v=vs.100%29.aspx

Windows Service not showing up when installed with Setup project

I have a simple windows Service developed in VS.net 2008 and VB.net. When I install the service using Installutil.exe from the command prompt it is working like a charm.
When I try to add a setup project and set the output and build and install it though it says successfully installed, it is not showing up in the services.
The event log shows that it is successfully installed. I just did check the registry, it did place the assemblies in HKEY_CURRENT_USER\Software\Microsoft\installer\assemblies.
But I don't understand why it is not showing up in the services listing. I refreshed and restarted.
Any thoughts??
Thanks
Found solution
You have to add a custom action in your MSI project.
So in custom actions, add the output of your service to the Install section. This will then run the required installation code for your service. i.e. the same as what the installutil.exe does
Thanks for all the help
I had the same problem and didn't pay attention to the portion BEFORE creating the Setup project.
http://msdn.microsoft.com/en-us/library/zt39148a(v=VS.100).aspx
To create the installers for your service
In Solution Explorer, right-click Service1.vb or Service1.cs and select View Designer.
Click the background of the designer to select the service itself, instead of any of its contents.
With the designer in focus, right-click, and then click Add Installer.
By default, a component class that contains two installers is added to your project. The component is named ProjectInstaller, and the installers it contains are the installer for your service and the installer for the service's associated process.
In Design view for ProjectInstaller, click ServiceInstaller1 or serviceInstaller1.
In the Properties window, make sure the ServiceName property is set to MyNewService.
Set the StartType property to Automatic.
In the designer, click ServiceProcessInstaller1 (for a Visual Basic project), or serviceProcessInstaller1 (for a Visual C# project). Set the Account property to LocalSystem. This will cause the service to be installed and to run on a local service account.
A couple of ideas:
Are you installing under the same Windows account that you are attempting to run it under? Do you have the Setup Project's "InstallAllUsers" property set to True?
Are you sure that you have the ProductName and Title properties in the Setup Project set correctly? Maybe the service is showing up in the list under a different name, i.e., "SetupProject1" or something.
Similarily, in your service's ProjectInstaller class, in design view, look at the properties of the ServiceInstaller and make sure the ServiceName and DisplayName properties are set to what you want.

Resources