I try to configure the MSTest Settings ssection [Step 3 Runner: Visual Studio (sln)]. My particular configuration require to call a set of scripts (TestSetup.cmd) before the tests. Everything works fine in Visual Studio, but I don't know how to call the scripts from TeamCity.
I tried to add in the MSTest metadata the .vsmdi file but without success. The script are not executed.
My question is how to call the command from TeamCity in the MSTest Settings section?
Thank you and best regards!
testrunconfig file:
This is a default test run configuration for a local test run.
MSTest Settings screen shot TestSetup.cmd
Versions :
TeamCity Enterprise 5.1.3
Microsoft Visual Studio Team System 2008 Development Edition
I
Add a build step before the MSTest runner which runs your testsetup.cmd.
Related
I need to run Visual Studio Load test from TFS using command line. I have following setup -
1.Visual Studio 2015 Enterprise
2.TFS 2015 Update 3
3.Developer Command Prompt for VS2015
I am able to run locally by opening Developer Command Prompt and using commandline /TestContainer:Loadtest.loadtest.
However, i'm not able to do the same in TFS build.
Can you please tell me what I should type in "Tool" and "Argument" fields for command line step?
Local VS is also using MSTest.exe command to run the Load test.
To run the loadtest in vNext build, you should also use the command line task and call MSTest.exe command in the build agent.
Tool: You can specify a fully qualified path of MSTest.exe command
Argument: Specify arguments to pass to the tool. Such as
/testcontainer:[ file name ]
Below is the snapshot from VNext for your reference:
Note: You need to use Test Controller/Test Agents 2013 Update 5 to run load tests on-premises according to this document.
When I try to execute NUnit test in VSTS task I am getting the following error:
Warning: The path 'C:\a\1\s\INCASOL.IP\packages' specified in the 'TestAdapterPath' does not contain any test adapters, provide a valid path and try again.
I have these tasks in VSTS:
The "Run unit test" task is configured as follows:
Note I have set the "Path to Custom Test Adapters".
I think the dlls for NUnit are properly copied to packages folder because in "Nuget restore" task I can see the following:
Added package 'NUnit.2.6.4' to folder 'C:\a\1\s\INCASOL.IP\packages'
Notes: The NUnit version is 2.6.4 and I'm using Hosted Agent
After a few hours looking for a solution, I solved it few minutes after having asked my question.
Although I could run my test in my local machine using NUnit Test Adapter, this package hadn't been added to my packages folder. So, once I run
Install-Package NUnitTestAdapter
for my test projects, everything works fine.
I've read many articles on publishing from TeamCity using various versions of Visual Studio. I'm currently using v.9.1.7 of TeamCity and Visual Studio 2015.
I have my 3 build steps on check-in:
Clean & Rebuild
Unit Test
Publish
When I check in my files I get a Tests Passed success message:
I can tell from here something isn't right as I'm expecting it to say something about publishing. When I look at the Build Log I see the following:
[12:48:22][API\API.sln] Publish [12:48:22][Publish] MSBuild [12:48:22][MSBuild] API\API\API.csproj: Build target: Publish
[12:48:22][API\API\API.csproj] _DeploymentUnpublishable
My Publish Build Step is setup this way:
In my API project in Visual Studio I can publish to the correct location on the network. Here is my publish profile:
I'm not sure what I'm missing. I'm expecting the Publishing build step to work like when I click the Build->Publish menu item in Visual Studio.
I'm guessing that I'm missing something or misunderstanding what the publishing build step is supposed to do.
Any help is appreciated.
I was able to get it to work after days and days of searching. I found part of the answer here on Stack Overflow. The trick was to get it to work from the MSBuild Command Line:
C:\TFS\project\myProject\APIproject>msbuild apiproject.csproj
/p:DeployOnBuild=true
/p:PublishProfile="Properties\PublishProfiles\DEV.pubxml"
/p:VisualStudioVersion=14.0
Once I got this running several times I was able to create a Build Step in Team City (see this question/answer) and I set the following:
Build file path: <location of the apiproject.csproj>
MSBuild version: Microsoft Build Tools 2015
MSBuild ToolsVersion: 14.0
Run platform: x86
Command Line Parameters: /p:DeployOnBuild=true /p:PublishProfile= "C:\TFS\API\API\Properties\PublishProfiles\DEV.pubxml" /p:VisualStudioVersion=14.0
IIRC, publishing from TeamCity requires certain files or alternatively VS installed on the build agent (which really isn't recommendable). Have you copied the necessary files to the build agent?
Where are artifacts location defined.
And you can use Tentacles for publishing build into various environments.
I guess, you need to look towards artifacts configurations.
You can use MSBuild runner to Deploy your Application/API
Add Command line parameter :
/t:Clean /p:DeployOnBuild=true /t:build /t:publish /p:PublishProfile=C:\_works\teamcity\publishprofiles\Publiush_Profile.pubxml /p:VisualStudioVersion=12.0
PublishPrfile URL should be your publish profile path.
This will work for you.
VS will probably find your publish profile with just the name, like:
/p:DeployOnBuild=true;/p:PublishProfile=DEV; very useful if you run more than one build agent.
And if you're deploying to an IIS you might need to add AllowUntrustedCertificate=true;
I have VS 2010 Premium SP1 and using MSTest
The project has a web reference to a Web Service
The tests are integration tests
TestDriven.NET-3.8.2877 RTM which includes NCover 1.5.8
My problem is that it runs the MSTests and creates the pass/fail *.trx file but will not create a coverage report. I get the coverage report if I right click and select test with\NCover. The problem is I want to run in in the command line so I can just make it a task in my continuous integration pipeline.
The error returned is:
Profiled process terminated. Profiler connection not established.
I searched for solutions and tried the following:
Using the //reg in the command line
Updating the config.exe file to use .NET 4.0
Forcing the NCover DLL to register
Here is my command line:
ncover.console.exe //x mstest_coverage.nccov "c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe" /testcontainer:D:\Perforce3666\serviceengine\SessionStorage\dev\SQATesting\SessionStorage.SQA.Testing\bin\Release\SessionStorage.SQA.Testing.dll
Is it possible to integrate chutzapah test running with visual studio build?
What I mean here is - if any test fails the build fails.. .that way..
I think you have 2 ways of doing this:
install the Chutzpah test adapter on each build machine and get the running the tests in test explorer.
Then customize your msbuild scripts to run the tests.
Use the command line + custom msbuild task
It looks like Chutzpah has a command-line runner, so you can create a PowerShell script which gets called from your build server to run the tests. See the Chutzpah documentation for more information, but it should be chutzpah.console.exe under: Chutzpah.3.2.4\tools
Next if you want to integrate with Visual Studio build it means msbuild integration. Take a look at the exec task on how to run custom commands and react based on the results