I am trying to convert a build system setup with TeamCity and Nant scripts to use TFS2010 (We bought the license and might just as well make use of it) After some work I get the web project to build and deploy to the web-server. We have a domain, API, test and web project in our solution.
How do I configure TFS to run the unit tests that we have written so far? I did configure the build to look for ***.UnitTest.dll in(VS2010) Edit build definition>Process>Automated Tests
Now the build fails with a message that says:"Could not load file or assembly 'nunit.framework, Version=2.5.3.9345" Am I correct when I say that TFS is trying to run NUnit on the build server? I did install NUnit-2.5.3.9345 on that TFS2010 build server and still nothing?
Thank you
Jack
The build facility in TFS uses MSTest as test runner, with which it's tightly integrated.
If you want to run your unit tests with NUnit as part of your build, take a look at the NUnit for Team Build project on CodePlex.
The project started out for TFS 2008, however support for TFS 2010 has been added in version 2.0. Note that this feature is still in early stages of development, so your mileage may vary.
I'm late to the game, because I've had to deal with this issue recently. I found this article helpful for me in this. It didn't work right off the bat, but I found if I added it into my buildscript via the controls in a similar manner/pattern, it would work.
My only problem now has been getting it to actually error (right now it warns) even when flagging them to cause the build to error
Link: http://blog.gfader.com/2011/06/running-nunit-tests-in-tfs-2010.html
Related
Successfully building an MVC project using a basic build agent, meaning an agent created using only the TFS 'Agent Pools' download and setup process.
From reading many SO posts and observation while trying to add Tasks to my Build Definition I have come to understand that a 'basic' Build Agent can build a project but seemingly do little else. For example, I understand that to run unit tests on the Build Agent, Visual Studio will need to be installed. But I had (naively) assumed at least MSBuild was installed on the Build Agent; it seems not.
Question 1: Please confirm if MSBuild must be installed in order to add additional MSBuild tasks to my Build Definitions? Can I install just MSBuild?
Question 1a: If MSBuild is not on the basic Build Agent, what is the Build Agent using to build projects?
Question 2: If I want to do unit tests on the Build Agent, will the free VS version (Community 2017) be sufficient, or do I need to install the full version of VS? (I am running full VS/TFS onsite versions) Some other forums suggested in prior year versions the free VS version (I believe called Express) was sufficient for unit testing on Build Agents.
Question 3: Are these the only 2 'levels' of added packages I would ever need on a Build Agent, MSBuild or VS? And if I only installed MSBuild at first, would I run into problems adding VS to the Build Agent later because it will install MSBuild over the previous MSBuild install?
The agent is just a task runner. If you want to do things that require Visual Studio normally, install Visual Studio. If you want to do things that require, say, NodeJS, install NodeJS.
There is no licensing requirement for build servers, so there is no reason to not install the highest SKU of Visual Studio for which your organization owns licenses.
I have started using VisualStudio.com build services for my continuous Integration. However some of my test projects use JustMocks and I can't find an easy way to get this working in the cloud.
Has anyone got any easy methods of doing this?
Do I need to create my own hosted build agent or is there another way?
If JustMocks required to be "installed" then you will need to either create your own agent or change your tool. To be honest I don't recommend using a framework that needs installed. I would ask Telerik about options.
JustMock should provide a Nuget package that you can reference so that you don't need to install anything on the build server.
JustMock provides installation-free elevated mocking specially for shared build servers. Depending on what build system you use, there are integration points for MSBuild, TFS Build and through the environment.
I need to run nUnit tests using a workflow template in TFS Server 2010.
I found all the reference bellow explaning how to configure the Build server:
http://morten.lyhr.dk/2008/05/using-nunit-and-ncover-with-tfs-build.html
How to run nunit with msbuild from VS2010
http://www.codewrecks.com/blog/index.php/2009/07/19/integrate-nunit-test-into-a-tfs-build/
http://msdn.microsoft.com/en-us/library/ee342461.aspx
Bellow is closest to what I need:
https://tfsbuildextensions.codeplex.com/wikipage?title=How%20to%20integrate%20the%20nUnit%20build%20activity
But the answer I need is for the question bellow:
"How to set a variable containing all the nUnit tests and how to configure a for each loop to run all the tests"
I do get all my build to run, but in the end, it does not run any nUnit test.
But which tool should I use to run the nUnit tests?:
Please let me know if you have any advice on how to get it done using the TFS 2010.
Thank you so much.
The post •https://tfsbuildextensions.codeplex.com/wikipage?title=How%20to%20integrate%20the%20nUnit%20build%20activity gives all the steps required to make use of this community TFS extensions. It is meant to be a step by step to get the activity working
Step 1 of the notes shows how to find all the assemblies that have been built, basically scan a for any file ending *.dll. I think this is the key to your question, you just pass a list of all DLLs produced by the build and let nUnit find the tests. If you want to do something else you can build the list of DLLs any way you want, but a scan seems the most simple, you don't have to worry over managing the list ypourself
Step 2a runs the nUnit test, the list of DLLs is passed into the nUnit activity (in effect the command line test runner). This will look in each DLL for the nUnit attributes and run the tests it finds.
Step 2b publishes the results back to TFS. This is done by taking the XML output of the test runer and publishing it with MSTEST to the TFS server.
If you are using TFS 2012 or later I would not use this activity, I would use the new test adaptor model built into TFS http://blogs.blackmarble.co.uk/blogs/rfennell/post/2012/03/27/Unit-testing-in-VS11Beta-and-getting-your-tests-to-run-on-the-new-TFSPreview-build-service.aspx and http://visualstudiogallery.msdn.microsoft.com/c8164c71-0836-4471-80ce-633383031099/
I was missing two steps answered in the link bellow:
Visual Studio Online CI Nunit Tests not found during build
1 - To add the nUnit adapter on each test project
2 - To add the nUnit 4.5 dlls to the build server and check it in
We have migrated few projects from TFS2008 to TFS2010 by using the method-
1.Attch TFS2008 DB to TFS2010 DB
2.Tfsconfig import
3.Delete the project not required.
There are few projects in the migrated projects which use VS2005. They do not want to do any change in their project and want to use VS2005 to work with migrated projects. We have applied couple of patches in VS2005 and now they are able to access the TFS2010 projects from VS2005.
However we are clueless about the build configuration. We have configured build server for their Collection...now what configuration needs to be changed in TFsbuild.proj to make the build run again.
Is there any more steps required to make the build work?
Any help would be very much appreciated.
Thanks Upfront.
Kabir
If you have not had a build definition for you TFSbuild.proj then you will need to create one. In your build definition, you will need to choose UpgradeTemplate.xaml as the build process template. In TFS 2010 this template is used to run legacy build definitions.
See how to run build with the UpgradeTemplate.xaml here.
I also found this useful post in the MSDN Build Automation forum that tells you the differences between 2010 and 2005 build processes.
I am working on a web application in VS 2008. To compile the applicaiton I go to Build in Visual Studio and click on Build Solution and when i have to deploy the site I click on Publish and it publishes the site to a directory.
Now my question is when do we use this msbuild file? what exactly this file does for Us?
Thanks.
You use a Build file when you have to do a series of operations that you want to do before or after compiling. This is used in most of the big projects where there will be other things (examples for other things are given below) that needs to be done and through MS build they will automated.
Examples of things that can be done with build :
Running Unit tests
Functional testing
Static Code analysis and reports
Packaging as an installer