Posts Tagged ‘dotCover’

TeamCity plugin for Visual Studio

Wednesday, March 13th, 2013

When working with TeamCity and Visual Studio, we can do a lot of things right from within our IDE. We can trigger a remote run, fetch dotCover code coverage information from the server, view changes and builds from a tool window, navigate to unit tests and a lot more. In this post, we’ll be looking at some of these features. But first things first: let’s install this nifty tool!

Installing the plugin

Every TeamCity installation ships with several tools for IDE integration (with our IntelliJ IDEA based tools as well as with Visual Studio). We can find the plugin on every TeamCity server under the My Settings & Tools page. We can download the plugin right there!

Finding the TeamCity plugin for Visual Studio

After downloading and installing the plugin, we can find a new menu item in our Visual Studio.

TeamCity plugin for Visual Studio menu entry

From this menu, we can connect to our TeamCity server using the Login… menu item. After entering the URL to our TeamCity server and providing the correct credentials, we can start exploring.

Login to TeamCity

Remote run from Visual Studio

When developing a project in Visual Studio, we can initiate a personal build using the TeamCity plugin for Visual Studio. We call this a “remote run” because the build that is triggered runs on a TeamCity build agent, not on the developer’s machine. The interesting thing here is that this remote build uses the current version control repository sources plus the changed files in the developer’s IDE. All steps from the build configuration are executed for this personal build as well.

After changing some files locally, we can use the TeamCity | Remote Run (Local Changes) menu to trigger a remote build. In the dialog that opens, we can select the changes we made locally that should be included in this personal build. We can select all changes or cherry-pick just the changes we want to verify on the build server.

Note that we’re using Subversion as the source control system here. Remote Run is available for TFS, Subversion and Perforce. When using Git or Mercurial, the workflow is slightly different. Check the documentation on branch remote run for more information.

When we click the Configure personal build… icon in the toolbar, we have to make some other decisions. First of all, we must select the build configuration we want to use for the personal build. Next, we can provide a comment for this personal build. This comment will be shown in the TeamCity web UI afterwards to describe the personal build.

One interesting option is the Pre-tested Commit checkbox and its related commit if setting. Using this, submitted code changes first go through testing. If all tests pass, TeamCity will automatically commit the changes to version control and integrate it in the next build. When tests fail, the code is not committed and the developer who made the change is notified about this. Here’s a chart of the pre-tested commit workflow.

Personal build configuration and pre-tested commit

We can even customize our build: put it at the top of the queue or add additional build parameters.

After clicking the Run button, TeamCity will run the selected build configuration for the included changes. We can see the results in the TeamCity web UI, consult the build log, check unit test results and so on.

TeamCity web UI personal build

My Changes

Since this post is about the TeamCity plugin for Visual Studio, we can also verify the status of builds triggered because of our changes by using the TeamCity | My Changes menu.

Overview of My Changes

Build log

From the toolbar, we can consult the build log for every personal build listed in the My Changes window. Clicking the Show Build Log icon (or right-clicking the build and selecting the appropriate context menu) will instruct the TeamCity plugin for Visual Studio to download the build log directly from TeamCity.

Build log from TeamCity downloaded in Visual Studio

Open Failed Tests

Did your changes cause a unit test to fail? No worries: we can use the Open Failed Tests context menu from the My Changes window in order to see what is going on. From the window that opens we can re-run the failing tests locally using the ReSharper test runner.

Unit tests

Code Coverage

When you have dotCover installed on your machine, the TeamCity plugin for Visual Studio enables us to view code coverage results. Using the TeamCity | Coverage menu item we can select a code coverage snapshot to open.

TeamCity dotCover code coverage

After selecting and opening a snapshot, we get dotCover’s test runner showing code coverage. We can even double-click a class from the snapshot shown and explore code coverage at the statement level.

dotCover snapshot from TeamCity

Investigate a build

Whenever a build fails, we can volunteer to fix the build by starting an investigation. From the TeamCity | My Investigations menu, we can manage our investigations and take action on open investigations by either fixing it or giving up (when working in developer teams in Belgium, that last option typically results in having to bring pastries for the team).

Investigate a build

Open in IDE

The TeamCity web UI features an Open in IDE button on many places. For example, when inspecting changes that were included in a build, we can open the file that was built in our IDE by clicking the IDE icon.

Open in IDE from TeamCity web UI

We can open tests in the IDE as well, again using the Open in IDE function. When working with tests, this will trigger Visual Studio to open the ReSharper test runner and display the selected test.

Open test in IDE

Give the TeamCity plugin for Visual Studio a go and let us know what you think!

TeamCity 6.0 RC (build 15673)

Friday, November 12th, 2010

As the major TeamCity 6.0 release approaches, the release candidate build is already available. Besides bug-fixes, it contains several enhancements and improvements. For example:

  • dotCover coverage engine now reports statement coverage instead of line coverage.
  • .NET coverage options are now available in MSTest build runner.
  • For each Maven build TeamCity agent gathers Maven specific build details, which are available on the dedicated “Maven Build Info” tab after the build is finished.
  • Swabra settings now reside in a separate section called “Build Features” which is available on “Build Steps” page.
  • and more.

As usual, we remind you to back up your data before upgrading to a new version. Stay tuned, the big day’s closer than it might seem;)
Download TeamCity 6.0 RC.

TeamCity 6.0 EAP (build 15638)

Tuesday, November 2nd, 2010

New TeamCity 6.0 EAP build is now available with Gradle support described in previous post and several new features and major improvements:

  • Improved upgrade procedure. First of all, we have reworked the upgrade procedure. Though it already was quite painless, we’ve made it more explicit and smooth. Usually, a typical TeamCity upgrade requires conversion of database and configuration files. Since, previously this was performed automatically, it could be not clear what and why had happened. Now, when TeamCity decides that the data conversion is required, it asks for confirmation from server administrator and suggests to perform a backup (which we highly recommend in any case). Thus you’ll always know what’s going on, and when it’s time to back up your TeamCity instance. Automatic backup will be available, but only starting with version 6.0 or higher.
  • Ability to explicitly select build configurations for an agent. Though TeamCity can distribute builds to agents based an agent requirements specified in build configurations, we know that some of our users prefer to explicitly specify which configurations can be built on which agents, and do not want to allow building of other configurations on these agents. That was possible in previous TeamCity versions, but starting with this EAP we have improved the UI for manual configurations selection. Give it a try! We believe, new UI has become better and more convenient, even if you have a huge number of build configurations.
  • Auto-Completion in agent requirements. Now specifying agent requirements is easier and faster – just start typing a parameter’s name or value. Plus, you can see how many agents have this parameters defined, and with what values.
  • JetBrains dotCover integration. Recently our .NET guys have released a brand new .NET coverage tool called dotCover, which includes lots of neat features, like reporting statement-level coverage in .NET Framework and Silverlight applications, highlighting for covered and uncovered code right in Visual Studio, detecting which tests cover a particular location in code and much much more. Starting with this EAP, this promising coverage engine is bundled with TeamCity and is available next to NCover and PartCover.
  • and more

See the release notes for complete list of changes, download the build and send us your feedback!

And as usual, don’t forget to back up your data!;)