make ccnet self test - cruisecontrol.net

i want to run a test project in ccnet,
can anyone help?
i am not using NUnit. I am using [Test Class()] attribute in my web project, and wanna run this project from ccnet

It appears the test framework would be MsTest
In order to run MsTest on the build server you have to install visual studio or do a work around or hack (alternate hack).
Then you can use MsTest.exe
Here is the official documentation on running MSTest tests.
Similar question and more hacks or work-arounds

If you're using NUnit, you may want to take a look at the documentation

I'd suggest looking in CCNet to run a msbuild task
There are a number of examples to run MSTest from MSBuild tasks.
This one looks prommesing:
http://harriyott.com/2005/07/running-mstest-from-msbuild.aspx?post=/2005/07/running-mstest-from-msbuild.blogpost
--
I myself am using NUnit and xUnit. Might you consider switching to NUnit for testing? There is a wider adoption of NUnit in combination with CCNet, which makes searching answers easier.

Related

Run NUnit Tests in VS2012 Continuous Build

If anyone knows the correct spell to make NUnit tests run when in the Continuous build in 2012 I'd love to hear what it is.
I have scoured Google and found lots of articles like this one and I've carried out the steps it suggested I needed. I battled with the Build refusing to find nunit.framework.dll and finally got it to build. Only when it built it ignored all of the tests 'cos it would only look for and run MSTest tests :-(
I would really appreciate any pointers on how I modify the workflow to look for and execute NUnit tests.

Visual Studio 2012 MSTest vs NUnit pros and cons

We have to decide which technology to use for our unit testing. Currently we use Visual Studio 2010 and not happy with MSTest that came with that. It is buggy, poor in deployment (E.g the test setting output directory is not recognized correctly), and have several issues when trying to test assemblies in 32bit and 64bit versions. To make matters worst MSTest does not have a good impedance match with our Jenkins build system. We therefore thought of moving into NUnit. However, no one in our team has a good exposure to NUnit. Also,we will be soon moving into Visual Studio 2012.
I need to know the pros and cons of Visual Studio 2012 MSTest vs Nunit latest version. Since most of the articles on stack overflow are related to older versions of VS they are not related to us. I guess Microsoft has improved MSTest a lot since 2010. Please provide an unbiased comparison with detail technical issues you have faced in both technologies (newer versions only)
I'm using both MSTest and NUnit at the moment. IMHO NUnit is still a better solution. If you have Visual Studio 2012 Premium edition then it's actually quite nice, except for the fact that you can't seem to group together tests. I like the fact it's integrated into Visual Studio, but the lack of grouping and the ability to run a subset of tests without manually selecting them is a huge problem.
The coverage analysis is also pretty neat in Premium. It's fast and gives you what you need quickly. It is a Premium feature though.
Since there are still lacking features in MSTest (even removed features since vs2010), I would still recommend using NUnit for unit tests. The benefits include test grouping by namespace, the ability to add test case annotations (running the same test multiple times with different parameters) and it works well with Opencover and Report Generator for coverage analysis. The main cited con is that it's not integrated like MSTest, so it really depends how much that matters to you as to whether or not that is a con.
#Biranchi: It doesn't matter anymore which unit test framework you use in Visual Studio 2012 (and upwards). See my blogpost here, the sequel to the one you refer to. http://blogs.msdn.com/b/visualstudioalm/archive/2012/11/20/part-2-using-traits-with-different-test-frameworks-in-the-unit-test-explorer.aspx
You can even mix and match tests from different frameworks, you can even do that down to the method level !!
This means you can even move legacy code from one to another with no bad sideeffects.
Also see this for how to use Nuget to install the NUnit adapter into the solution, freeing the developer for installing it herself.
http://blogs.msdn.com/b/visualstudioalm/archive/2013/06/11/part-3-unit-testing-with-traits-and-code-coverage-in-visual-studio-2012-using-the-tfs-build-and-the-new-nuget-adapter-approach.aspx
#Sriwantha: MSTest is a simpler framework than NUnit. NUnit (and also XUnit) give you more flexibility, which also leads to less code to write. One example: If you are using categories (and you should), MSTest require a category to decorate every method. NUnit allows you to decorate the class - that will take effect for all the methods in that class. NUnit also allow to you use strongly typed categories
public class Integration : Category {}
This is enough to declare a category that you can use instead of
Category("Integration");
where you risk spelling errors.
NUnit has much better support for data driven tests.
NUnit has also support for theories
to name a few.
VS2012 does allow categorization of tests into groups if you have "Update 1" or later:
http://msdn.microsoft.com/en-us/library/hh270865.aspx#BKMK_Grouping_and_filtering_the_test_list
Have you looked into Traits functionality of VS ?
http://blogs.msdn.com/b/visualstudioalm/archive/2012/11/09/how-to-manage-unit-tests-in-visual-studio-2012-update-1-part-1-using-traits-in-the-unit-test-explorer.aspx
Grouping is much better in mstest (2012 update 1) compared to nunit.
One more thing to add here. It looks like MSTEST engine doesn't work well with TFS Build in certain scenarios. If you are using TFS build, it won't report the skipped tests (marked with Ignore attribute). It will only include Assert.Inconclusive. If that's an issue, you should use NUnit instead of MSTest.

sonar for .net 4 in ccnet

hi all
does sonar support .net 4?
if so how can i integrate sonar with cruisecontrol.net (ccnet) with out using maven o anything else.just sonar and ccnet..
thanx
Take a look at the wiki page mentioned before and if you encounter any trouble, feel free to register to the user mailing list and ask for help (see http://www.sonarsource.org/support/support/).
For now, even if sonar 2.6 may use ant or a simple command line to trigger the analysis on a java project, maven is mandatory for a .net project. This will change pretty soon. I am working with the guys from sonarsource to give birth to a new "C# plugin"... First version probably at the beginning of this summer.
For now, only solution I see to integrate sonar with ccnet is to launch a maven command line from ccnet.
I documented my experience setting up Sonar with my C# projects. I used TeamCity instead of CCNet, but that's a small portion of the overall setup, so should be straightforward to configure. http://www.wrightfully.com/setting-up-sonar-analysis-for-c-projects/

Why is it such an effort to setup code coverage in TeamCity?

I'm using Teamcity 6.0 and want to add code coverage to our NUnit tests.
PartCover has been a massive issue due to it not running on x64 server and so now I have to go and git it and build it myself :(
Also, jetBrains, if you know the xslt is broken, make it easier for me to fix it.
Does anyone else have PartCover working?. Maybe this might help :
http://www.jeremyskinner.co.uk/2010/07/23/using-teamcity-with-partcover-4/
Don't bother! Just install dotCover. It just works!

Running Resharper code analysis outside of Visual Studio

Resharper includes various analysis rules which can be run on your solution from inside Visual Studio but is it possible to run these from say the commandline or as part of your autobuild? Resharper seems to be focused on running in Visual Studio but can it be invoked on solution or project files from outside the IDE?
UPDATE: Seems like TeamCity 7.0 EAP includes a way to execute the code-analysis while building
(blog post) so at least it can somehow be invoked and utilized as part of a CI process.
No, this feature is not currently offered by ReSharper. There is a thread on the JetBrains website related to this question and it can be found here.
Here's a quote:
Currently ReSharper has no interface
from running in a standalone batch
application. However, it is possible
to write such an application that
provides the functionality you're
looking for using ReSharper OpenAPI.
So apparently you could use the ReSharper OpenAPI to create the functionality you want; unfortunately, I haven't had any experience in using it so I'm not much help there.
Some links of interest...
ReSharper OpenAPI Developer Community
ReSharper public API and sample source code (aka. ReSharper PowerToys)
I think you want the functionality provided by fxCop. I am not aware of Resharper functioning outside of Visual Studio.
Looks like they're listening! First version available as a 30-day demo now: http://blogs.jetbrains.com/dotnet/2013/03/resharper-code-analysis-goes-beyond-visual-studio/
If you're looking for compliance of code to standards, take a look at StyleCop. You can tie it into msbuild and run the rules outside of the IDE.
No, it can not be run from commandline. I still hope that they add this feature since I requested it last october :)

Resources