Specify NUnit categories with TFS vNext (2015) - nunit

Does anyone know how to use "Test Filter Criteria" field in the "Run Functional Test" of vNext build step, to specify the categories of tests to be executed by NUnit test adapter?
When I set this field with TestCategory=CatA for example, the build fails...
(Following https://www.codit.eu/blog/2015/03/18/continuous-integration-with-javascript-nunit-on-tfsbuild-part-3-of-3-/)
Thanks!

Hope this will help someone someday, the right way is to use the keyword "Category"
Example:
(Category=CatA&Category!=CatB)|Category=CatC
I use here the "Run Functional Test" build step

I think you are using the wrong build task in Vnext. To execute NUnit test in a vNext build you should ensure that appropriate tests adapters are available to agents that will run the build.
The easiest way to automate all the process is adding Nunit Test Adapter nuget package to your test project, adding a standard Nuget Reference.
Once you’ve added the package, you should see all needed assemblies under the package directory of your solution. Now you can specify the location that contains the Nunit Test Adapter directly from Build Definition using this string.
This blog describes clearly how to do this: Running NUnit Tests in a TFS 2015 Build vNext

Related

How can i change Configuration Properties of a VS Solution using Powershell?

I am compiling a solution and want to not include some projects in the build.
I can manually go to the solution properties and unmark the build check box for those projects , but i am automating this , so is there a way in powershell i can set certain projects as not to build ?
Instead building the solution you can build only the projects from the solution you want to build. Building is not really related to PowerShell. I suppose you use .NET Core that build the solution file. dotnet build is able to build a single project. You can chain dotnet build commands to builds each individual project you want, and exclude some of them.

nant: best way to separate out nunit test dependency from production package

I have a nant project that builds my c# library, but has a dependency currently on nunit for building the test library portion of my project. Our users of the package have complained that they don't want this dependency in a production environment.
I'm new to nant configuration, so am looking for ways of making this dependency optional, or where you need to opt-in to it it for development building, perhaps as a target flag.
I don't think you can do so in Nant. But, since nant would work on the project files, you can add a condition to the project file like this -
<ItemGroup>
<MetaDataFile Condition="'$(Configuration)'=='Debug'" Include="$(BuildProjectFolderPath)/SubFolders/MyTestListFile.vsmdi">
<TestList>My Test List Name</TestList>
</MetaDataFile>
<TestContainer Condition="'$(Configuration)'=='Debug'" Include="$(OutDir)\MyTests.dll" />
Found this here.

How To Configure Ant Plugin For Jenkins

I have marathon Project where I have buid.xml which has many targets all are runned with the help of ant tool. but in the jenkins I need to select a target which I only need to build and test. I need to know how to achieve this using parameterized and invoke Ant ???
Can any one help to me !!
Here is another question which deals with sending parameters to Ant builds.

Run All the Tests

Is there a way to run all the tests in multiple eclipse projects?
I have a maven multi module project and want to use emma to show me code, that is not covered by any tests, not matter in which submodule it lies. So my idea is to have a single emma-coverage run, that includes all the tests of all my modules.
is there a way to do this?
You could have a look at jacoco which runs your tests in an ant/emma context and generates a report - the report component is able to merge the results from each submodule into a single report.

Is there CI server software that can do all of this?

I'm trying to put together a Continuous Integration server that will do the following:
Work with subversion
Use NUnit tests (fail build on failed tests)
Use partcover (fail build on < X% coverage)
Run code against FxCop (fail build on FxCop warnings, given settings)
Run code against StyleCop (fail build on StyleCop warnings, given settings)
Not as important:
Be able to run from a sln file
Be able to publish the application (ClickOnce is setup for the project already)
I'm using TeamCity right now and it doesn't seem to do 3 or 5, and it doesn't have a runner for the newest NUnit.
From the list of plugins that hudson has, it looks like it can do all of these except 3 (and the not as important requests). I've considered writing a plugin for hudons to use partcover, but that's adding more time to setting up a build server.
NAnt can be used as a build script which will build your projects and then execute NUnit and FXCop.
Another option, which is what I use at work, is create a build script for MSBuild and use the MSBuild Community Tasks which support running FXCop & NUnit among other things.
So for my setup CCNet pulls down the source from SVN then calls MSBuild with the main build file. Inside there it builds the projects, runs NUnit, NCover, FXCop, StyleCop etc. and merges the results which are then displayed on the CCNet webpage. Each task can also be set so if there's a failure the build fails.
I haven't used TeamCity but there should be a way to pull down the source and then run an MSBuild or NAnt build script which will then handle the build steps.
It's not a continuous integration server if it's run from a sln file. Perhaps you're mixing build tool and continuous integration. Many CI servers today does nothing but run build scripts made for other tools like NAnt or Maven. Look at NAnt first if it's what you're looking for. NAnt is able to do the build and execute other tools like FXCop (using NAntContrib library). You use CI server to run a build script on a regular basis.