Monthly Archives: August 2011

Native NuGet Support in TeamCity

A few months ago, Scott Hanselman gave a session at TechEd US were he showed some new features we were working on for TeamCity, in order to provide first class support for NuGet. He later blogged about it here.

Instead of delaying until the next release of TeamCity, this feature (like many), has been developed as a plug-in. Eugene, who has been working on it, announced the availability of a first build a few weeks ago. After some initial trials and changes, I decided to setup YouTrackSharp to automate the publishing of the NuGet package. It was surprisingly easy as you’ll see.

1. Installing the Plug-in

If your project is running on TeamCity at Codebetter.com, you can skip to Step 3, since it’s already installed and configured. If not, then grab the latest build from our public TeamCity server. Place the zip file into the plugins folder of your TeamCity installation and restart the server.

2. Configuring the NuGet version

Once the server is running, and agents updated (automated procedure), you then need to tell TeamCity what NuGet version you want to use. The plug-in knows about the nuget.org feed to it can grab the latest version of the command line tool directly. Click on Administration | Server Configuration. If the plug-in installed correctly, you should now have a new Tab called NuGet:

AdminPanelNuGet

Click on the “Install additional versions of the NuGet.exe Command Line”. TeamCity will read from the feed and display available versions to you in the dialog box. Select the version you want and click Install:

NuGetVersion

Pull, Pack, Publish

The plug-in offers three main operations:

  • Pulling NuGet packages required to build your project
  • Creating NuGet packages
  • Publishing Packages

In my case, I want to create the package and publish it. To give you a general idea of my build process, here’s the outline of the build steps:

BuildOverview

The NuGet related steps are 3 and 4. Step 1 simply builds the project by building the solution file. Step 2 runs the MSpec tests.

3. Building the package

This step is for building the actual package. We create a new Build Step in our project and select NuGet Packages Pack. This will give us the following configuration screen:

Step3

As you can see, the configuration is pretty straightforward. Notice that in the Specification file, we can also provide a csproj file as opposed to a NuGet spec file. The advantage to this is that we do not have to redefine information such as version number and copyright information in the spec file. If you’re not familiar with this feature, check out David Ebbo’s post.

I’ve also checked the option to Include Sources and Symbols. This is also explained in David Ebbo’s post and it’s for publishing the sources to Symbolsource. Additional command line parameters (if required) can be passed in the Additional Commandline arguments. If you want to make this a release build, you can also do this by defining Configuration=Release in the Properties field.

Finally I’ve specified the Build number of the package using the TeamCity variable %build.number% which auto increments on each build, and is also used by another feature of TeamCity new in 6.5 which is called the AssemblyPatcher, which I’ll show you as the last step.

4. Publishing the package

The next step is to publish the package. As before, we need to add a Build Step and select NuGet Packages Publish.

BuildStep4

This step is even easier to configure. By convention it uses nuget.org as the destination to publish the package. If you have your own NuGet server then fill in the address in the Packages Sources field. If you’re using nuget.org, leave it blank. You need to provide your API key which is stored in a password protected field and finally indicate which packages you want published. Here you can list each package individually or use wildcards. [Note: relative paths are allowed but at the time of writing this post, there was an issue and I was using the full path. This should be fixed soon].

If you want to publish to multiple sources, all you need to do is add another step. Note however that we did not have to specify an extra step to publish the sources to symbolsource.org. TeamCity will follow NuGet’s convention and do this for you automatically.

5. AssemblyInfo Patcher

Although this step is optional I recommend you use it. The AssemblyInfo Patcher is a new Build Feature added to TeamCity which temporarily patches all your projects AssemblyInfo.cs files to update the version number, and then reverts it back after the build is complete. This allows your build number, artifacts, packages and assemblies to all have the same version number. Adding this option is as simple as selecting it from the main project configuration screen:

AssemblyPatcher

That’s it. There’s nothing more to it. With a few simple build steps we have now fully automated packaging and publishing NuGet packages. As I mentioned initially, if you’ve got your project on CodeBetter, you already have this feature enabled. If you’re running your own server, just download the plugin and set it up. It’s very simple.

Try it out and please give us your feedback!

New Features in ReSharper 6 Unit Test Runner

Previous posts introducing ReSharper 6:

 

ReSharper 6 includes a series of new features and improvements in the test runner, as outlined below.

NUnit TestCase

We now fully support NUnit’s TestCase, TestCaseSource, Values, sand other attributes. Given the following tests:

 

image

 

ReSharper outputs the results as individual tests, appropriately grouped.

 

image

 

This allows us to now run and view tests individually.

 

image

 

As expected, dotCover  and dotTrace also provide support for this.

 

Support for Coded UI Tests with MSTest

 

Coded UI tests (when appropriate) are also supported now with the ReSharper test runner

image

Default Keyboard Bindings and Test Re-Runs

 

Out of the box ReSharper now ships with pre-defined shortcut keys for running, debugging, re-running tests, among other things. This eases the pain of having to map keys on new installations (as of ReSharper 6, you no longer loose your key bindings during upgrades!). By default, the key-bindings for the schemes are:

 

 

Operation Visual Studio IntelliJ IDEA
Run Unit Tests. Context Sensitive Ctrl+U, R Ctrl+T, R
Debug Unit Tests. Context Sensitive Ctrl+U, D Ctrl+T, D
Run ALL Unit Tests Ctrl+U, L Ctrl+T, L
Run Current Session Ctrl+U, Y Ctrl+T, Y
Rerun last test. Context Insensitiveimage Ctrl+U, U Ctrl+T, T

 

This last shortcut is a new feature added in 6 which allows us to re-run the last test we just ran. And we can run it from anywhere! This makes TDD for instance very easy as we can write some code, be in the actual code and run the test, without having to switch back to the test or open up the unit text explorer.

 

Running Tests from File Structure and Find Results Windows

 

You can now run Tests directly from the File Structure Window

 

SNAGHTML14c0e0a

 

as well as the Find Results Window

 

SNAGHTML14d0b1d

 

again, removing some of the friction when it comes to testing.

Categories

Certain Unit Testing frameworks provide test categories. For example, in NUnit there is the [Category] attribute. ReSharper now allows us to ignore specific categories and not run them during a test run. This is accomplished by indicating the category under ReSharper | Options | Unit Testing

image

 

When running unit tests, these appear as ignored.

image

This is useful for instance when we want to avoid running certain tests during development sessions.

 

Categories can also be used to run a specific group of tests by selecting these from the context menus:

 

image

Other improvements

Some other minor improvement or previous features we have blogged about include:

 

  • QUnit Support
  • Unit testing Sessions are now persisted between Visual Studio restarts
  • Ability to run tests in parallel from different assemblies, decreasing testing time (can be turned off in ReSharper | Options | Unit Testing)
  • General performance improvements
  • Update Progress indicator on Windows task bar

           image

 

As always, we welcome your feedback

Australia: First Contact

 

image

 

We have a lot of users in Australia, yet we’ve never managed to get out over there for a conference. That’s about to change. Next week, myself and Sergey Coox (ReSharper Project Manager) will be heading to the Gold Coast for TechEd Australia. We are sponsoring the event as well as having a booth present. It is going to be a great opportunity to see and talk first-hand to our users and also a personal chance to get to see (albeit very little) of Australia. We will ship a few hundred “I see dead code” T-Shirts also, so make sure to stop by the booth to pick yours up.

ReSharper Tips and Tricks Demo

We’ve managed to secure one whole hour at the Create Demo Booth that will be in the exhibit area to hold a ReSharper Tips and Tricks session, similar to those that have taken place at other conferences. This will take place on Thursday 1st of September 1 pm – 2 pm. It will be somewhere in the Exhibitor area. Pass by the booth during the week for more details.

YouTrackSharp and YouTrackForReSharper on JetBrains GitHub

Just a quick note to say that I’ve transferred the YouTrackSharp project from my own account over to the JetBrains account on github. I’ve also pushed the initial spike of YouTrackForReSharper which is a plug-in for ReSharper to talk to YouTrack. We’re looking for contributors for this project, so if you’re up to it, fork away!

When it comes to customers, don’t be defensive!

Have you ever heard the joke about the Dell Customer support call, where the customer says he can’t see anything on the screen and it turns out there’s no electricity? I’m not sure if that is a true story or not, but having spent a large amount of my life dealing with customers, I wouldn’t doubt it. I think some of the most memorable stories came from the time I used to work at an ISP, including this gem:

Customer: “I can’t send email”
Me: “What exactly is happening?”
Customer: “Don’t know. It just sits there”
Me: “You’re using Outlook Express right? Does some box come up when sending email?”
Customer: “Yes”
Me: “What does it say?”
Customer: “Says something about not finding some host”
Me: “Hmm. Are you connected to the Internet?”
Customer: “I don’t want to connect to the Internet, I just want to send email”

Of course, back then (talking dial-up connections), the Internet was also known as Internet Explorer. Today you can still get similar calls, except the Internet is now known as Google.

If my years of dealing with customers has shown me one thing, it is to be more humble, less arrogant and a hell of a lot more patient. And this has served me well in many aspects of my professional career, specially in dealing with other developers and talking to business people. That’s why I always recommend that developers should be in touch with customers directly, if not for any other reason than to improve their communication skills.

The customer is always right

I’m sure you’ve heard this saying before. And we can all agree that it’s not true, specially with those arrogant customers that are not only rude but are ignorant. How do you deal with them? How do you handle those support emails that not only undermine your competence but also attack your baby, your pride, your software?

There are mainly two options:

1. Show them how wrong they are by showing your competence and superiority and being defensive.

2. Try and explain to them why they might have made a mistake, without being defensive and always being humble. Never arrogant.

The first might release some of your anger and frustration, but ultimately it won’t benefit anyone. The second option will not only firmly and politely put the customer in his/her place, but also re-affirm your professionalism. And in the long run, you’ll gain some great communication skills which will help you in many aspects of life (except getting a date…we are still nerds).

Don’t be defensive!

Agile 2011 Conference – Salt Lake City

 

 

image

As like last year, JetBrains is again a sponsor of Agile Conference and we will be exhibiting at this year’s event in Salt Lake City. Yegor (TeamCity), Maxim (YouTrack) and myself will be there for the entire week (August 8th-12th), showing some of the new features in our tools, as well as having a chance to interact with our users, which is one of the greatest things when attending conferences, talking to you and receiving your feedback. 

Similar to all recent events, we are also using the opportunity to spend some time with customers on their premises, so if you are in and around Salt Lake City, be sure to let me know as soon as possible, if you are interested.

image

Finally, Daren Knopp has also been kind enough to set up a Nerd Dinner for Thursday August 11th seeing so many nerds are in town. RSVP here.