Posted on March 30th, 2007

Now this is cool news. It was announced a few days ago that Unit Testing and some other features are being moved out of the Developer and Tester Team System versions into the Professional version, meaning pretty much everyone will have access to it.

However, I disagree with Brad Wilson that unit testing should be in the .NET framework. I do think it should be in all versions of the IDE, including the free Express editions. And I also think that there should be a way to run unit tests on build machines without having to install Visual Studio. But moving it into the language – I think that’s too low level.

Still, very cool news, and I look forward to seeing what else the team does in “Orcas”

2 Comments


Posted on March 30th, 2007

I had a customer ask me recently for a way to auto-generate Unit Tests for Web Services based only on the WSDL using Visual Studio. Now, those of you who know me know I would call those “Integration Tests” (or perhaps “Deathly Slow Tests”), but a need is a need, and it’s actually pretty straightforward.

First, you need Visual Studio Team Suite (or at least VS for Developers or Testers) for the following. If you don’t have that, you can always download the 180-day trial.

What we are going to be taking advantage of is two things. First, when you add a reference to a web service (known as a “Web Reference”), a stub file is created that you would normally use to make the calls. Second, when a test project has a reference to another project, it adds an option to use a “Unit Test Wizard” which can autogenerate the test methods.

So, first, let’s fire up Visual Studio. I’m going to be using one of the Team Foundation Server web references here, but any web service should work.

Start by creating a new Project, and mark it as a Class Library. I named mine “TFSWebServiceLibrary” like so:

Now, let’s add our Web Reference. As I mentioned above, I’m going to be using a TFS Web Service, which can be found at http://yourtfsserver:8080/services/v1.0/ServerStatus.asmx. To add this as a web reference, right-click on the project and choose “Add Web Reference”:

Enter the name of your web service and then click “Add Reference”:

You’ll now see a new Web Reference in your project, called whatever you named it in the above screen:

It doesn’t look like much, but if you click the “Show All Files” icon near the top of your Solution Explorer, you’ll see there is much more than meets the eye:

Aha! See Reference.cs? That’s the stub file. If you take a glance at it, you’ll see lots of auto-generated goodness that does the magic of calling the web service. But, more importantly, we now have a code file that accesses the web service that we can generate tests against.

Generating the tests is actually a smidgen easier. Right-Click on your Solution, and add a new Test Project. I called mine TFSWebServiceTester:

Now for the magic. right-click on the project, and add a reference to the project we created above. (“Add Reference” -> Projects Tab -> and then choose the project we created in step 1). Now, right-click on the Project and choose “Add->Unit Test…”:

This will start the Unit Test wizard. Expand the nodes until you find the web service name you created when you added the web service:

If you expand that node, you’ll see the various methods you can call on that web service. May as well uncheck the properties, since we don’t care about testing those:

Now, Click Ok and watch the generation madness begin. When that finishes, you’ll now have a unit test capable of calling the web services. You’ll know the test because it will be shiny, new, and called WebServiceNameTest (for example, ServerStatusTest in our example). Now it’s up to you to modify the tests for the proper input/output variables. For example, I modified the GetSupportedContractVersion test to look like:

If you are going to be doing testing of web services, you definitely want to become familiar with this article which discusses various gotchas and how to test the web services locally instead of having to test on a remote server (which would be closer to a “unit test” – though the spinning up of a local web server would only reduce it to a “somewhat bearable” test).

No Comments


Posted on March 27th, 2007

This week I’ve been working with a customer to implement Forms Authentication for their MOSS site. Actually, it’s mixed authentication since they’ll have part via AD and part via a database. There are some great tutorials out there, but some people run into the problem I did – after modifying the web.config files, you have to add the user in the database to your SharePoint site. But when you enter the user into the People Picker, you get “No exact match found” and it won’t let you continue.

What I found was that if I switched the Central Administration site to use the provider I set up, I got an “Unknown Error”, which let me to think something bad was going on. Thinking through it more, I had in the back of my head that SharePoint would be accessing the database in the context of the current user, which is, of course, wrong. It access the database as the user you told SharePoint to use to access the database. So looking at that user, it didn’t have access to my authentication database, and once I granted it access, everything worked like a charm!

8 Comments


Posted on March 26th, 2007

Brian Harry just announced that Microsoft has aquired the company that makes the Teamprise web access solution for Team Foundation Server and is immediately making it available for free for all licensed TFS users. This is great news since one of the big challenges with TFS deployments is people not wanting to install Visual Studio / Team Explorer to manage work items. Very cool!

,

2 Comments


Posted on March 23rd, 2007

I’m catching up from my emails after being gone to an offsite event all week (what other company pays its employees to go to an offsite event and stay at the Bellagio in Vegas for a week?), and noticed that the Team Foundation Branching Guidance is now up and available on CodePlex. I saw a prerelease version, and it is a good document, though I still need to read all the way through it.

It’s also nice to see stuff like this getting pushed out to CodePlex instead of to some MSDN site. It just gives it more of a community-owned feel.

No Comments


Posted on March 23rd, 2007

When I was helping the NUnit team with Linux integration, Charlie tested moving the project to CodePlex. Which was all fine and dandy, except I couldn’t access the source code repository from my Linux box to pull down or push up code.

Well, Linux developers needing to access CodePlex rejoice! Teamprise, who makes a handy-dandy plugin for Eclipse to access TFS, announced they are making the plugin available to open source developers.

To get it, you need to go to the Teamprise CodePlex site for the details. They also have a press release up about it.

I’m excited because I just emailed out a couple of days ago to the GM of Platform Strategy saying that I was glad the work Microsoft is doing to bring open source concepts in house, but that it was disappointing not being able to access CodePlex from anything but Windows machines without buying a license.

I still want to play around with getting the native Team Explorer client running in Mono, but that’s for another day.

3 Comments


Posted on March 19th, 2007

Know .NET? Want to work for a company with incredible benefits and have an instant boost to your resume? We’re looking for a .NET developer for a position based out of Charlotte, NC. If you are interested, please shoot me an email (foyc at cornet design dot com) and let’s chat!

No Comments


Posted on March 18th, 2007

Several months ago, US Airways had made a bid for Delta, whom I fly a lot. Now, everyone has their favorite airlines, but something about US Airways from flying them out of Charlotte and St Louis had never sat right with me. Their attitude might have been captured by their company spokesman a few days ago. In the midst of a major winter storm threatning the east coast, and most of the major airlines cancelling scores of flights ahead of the storm (including Jet Blue who seems to have learned their lesson), US Airways spokesman Andrew Christie declared:

The weather is fine for flying

Of course, not just a few hours later had the company cancelling flights due to a lack of deicing equipment. And then the headline on CNN this morning showed the absurity of that statement – 100,000 stuck travellers trying to fly:

Thousands of weary travelers faced a third day waiting to reach their destinations Sunday as US Airways struggled to recover from the ice and snow storm that paralyzed airports in the Northeast.

The airline was still trying to find seats for 100,000 passengers systemwide whose flights were grounded by Friday’s storm, spokesman Andrew Christie said.

Fine for flying indeed. I’m so happy that the takeove..ahem…merger of US Airways and Delta didn’t go through.

No Comments


Posted on March 15th, 2007

Do you know C#? Do you know Design Patterns? Do you know Design Patterns in C#? Well, heck, you just know everything, don’t ya!

For quite a while, there has been a C# Design Patterns Group headed up by Damon Carr. It took a hiatus for a while, but is back in fashion. If you think you know your stuff, now is a great time to head over, because we are in the midst of a Decorator Pattern contest judged by Damon and yours truly.

Here’s the scoop from my post to the list:

We are looking for the best implementation of the Decorator pattern. What is the decorator pattern? According to the Gang of Four:

“Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality”.

To provide some framework to work in, this round is looking for decorator patterns that increment or decrement the price of a given object. For example, the base price of a car might be $5000 USD, and you can add on various aftermarket items like wheels, spoilers or really annoying tailpipes that increment the price. In addition, you might have incentives like a coupon, a discount plan or some other thing that decrements the price of the car.

Note that your implementation does not have to use the above example. You could use houses, boats, or green beans. The main rule is that none of the decorators can be mutually exclusive to cut down on the complexity.

Your application should:

– Allow for selection of a main item (at least one)
– Allow for selection of decorators (to either increase or decrease
the price) (at least 2)
– Calculate the total cost

We don’t care if the app is a web app, Winforms, or Console. I care if you used Test-Driven Development, but pay no attention to that, because I’m just a judge, and it’s not like I’ll knock you points for not using TDD. Maybe.

Again, the deadline is March 31st. Prices and Participation may very. 2 week lease at 4% APR with automatic upgrade to Gold-infused Platinum edition at the end of term. Void where prohibited. Must take dealer stock by 3/31/07. Have a nice day if applicable in your jurisdiction.

, ,

No Comments


Posted on March 14th, 2007

I’m on the road a /lot/ – about every week or so, working onsite with our customers to either help them get new technologies implemented, or help them recover from some pretty interesting situations.

This past week I was onsite with a customer who has decided on Team Foundation Server as the corporate standard for Source Control. So I was onsite to help them setup policies, branching and merging strategies, etc.

While I was there, one of the leads came over with an interesting challenge. They are doing Ruby on Rails development on Linux, but they have to use TFS as the Source Control. Now, Microsoft has partnered with a company called Teamprise to provide a Java client for accessing TFS from non-MS platforms, but they were having a problem where the code generated by rails wasn’t showing up in the Teamprise client as a pending checkin.

I collected some information, setup a repro here at the house, and got involved in a discussion with Martin Woodward. We ended up figuring out that they merely need to refresh the Eclipse project before they could see the checkins in the pending checkin window.

But this means that I got to help a team figure out how to workaround a problem preventing them from doing Ruby on Rails on Linux. Now, that was fun (even though I’m sure some sales people will panic if they ever read this).

1 Comment