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.
Related
I am working on a Java application project in NetBeans. I have added JUnit tests, with the #Test annotation. The tests work fine when I run them from the ‘Run Tests’ menu item.
I want to run the same tests from a command-line script. I do not know how NetBeans does this. I want a single command for testing the whole project. How can I achieve this?
Netbeans uses Ant as a build tool, and its default Ant configuration contains a number of useful targets. You can list them with the command ant -projecthelp (executed in your project directory), which should output, amongst other things,
test Run unit tests.
test-single Run single unit test.
test-single-method Run single unit test.
So, simply executing ant test will run all your unit tests on the command line. This will run the tests, write the test results to the standard output, and finish up with a brief summary (including a BUILD SUCCESSFUL message if all the tests passed, or BUILD FAILED if not).
The ant test command will return an appropriate exit code (0 if all tests passed, 1 if any failed), which can be useful -- for example, if you want to add a pre-commit hook to your version control system to forbid commits with failing unit tests.
You should build your project on the command-line with a build tool like Maven, Ant or Gradle and not rely on Netbeans for building it. Please search for this tools.
You should also consider to read a book about software development like Head First Software Development. They explain why and how to us a build tool (e.g. chapter 6 1/2 of Head First Software Development).
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
We have got SCCT to produce some pretty web-pages showing the coverage of our unit tests. And now we want to integrate this into our Jenkins continuous integration build.
I have created a Jenkins job to run the SCCT tests but how to a) fail the build if the coverage is below n% and b) how to display these pretty web-pages?
The build is a maven-multi-module project.
Cheers
We are using the jenkins cobertura plugin. SCCT emits a cobertura-format coverage xml file for each module (I didn't spot at first) and the cobertura plugin collates these. One problem is that the cobertura plugin needed to be downgraded to 1.3 as otherwise it thinks that the mojo hasn't been run and doesn't do anything.
Since this is possible for other coverage tools like cobertura via a jenkins plugin, you could either
convert the output of SCCT to something looking like the results of an existing tool and use the matching jenkins plugin.
write your own jenkins plugin, possibly borrowing code from existing plugins for other coverage tools.
Is there any way we can clean all/rebuild the projects in eclipse and run a jUnit test case every time we open eclipse?
I am developing an eclipse application. The scenario is that i want to schedule UI tests to happen automatically twice everyday. But i do not have an executable build as such. But have the full code base with me and i want to run some scheduled JUnit test cases(based on WindowTester) on it.
Any other ideas that you have is also welcome. :) Thanks in advance.
Ant requires a executable build to perform the tests on it from what i have read. :(
Regards,
Thomas
Tough Jenkins is opensource, Going for jenkins will be a good choice if you have more number of projects to manage. Jenkins dose lot more than automated test case and builds.
But, If you have a small code base and need to peform some specific tasks like
scheduled build and test cases, ant build will is much preferable.
In your case for running test cases,
Create a ant build script to build the entire project (How to write Sample Build scprit)
Create another ant script to read the jars and execute them using the tag (How to write Sample Test Build)
Write a bat file to call the ant scripts and Schedule build twice a day in windows scheduler available in control panel.
SO, this will compile, build your project and test it in scheduled time. Just trigger a mail from the ant script if test fails.
First time using team explorer, and I want to add a build task that will run a command line tool to obfuscate the assembly. This will one of the last tasks to be performed I assume.
How would I go about doing this using Team Explorer?
We use Xenocode Postbuild. To obfuscate, we use a custom build task we wrote in a DLL that we call from the build configuration in TFS.
So we created a custom task that wraps the PostBuild command-line. We pass that task variables from an MSBUILD target. That target is part of the project file associated with our release build definition.