Yesterday I found a great continuous integration server. Its called Hudson and is written in Java and can do loads of stuff with no complex setup. Right out of the box it supports Ant, Maven, Cvs, and Subversion. In 10 minutes I was up and running periodical builds of my XBMC python scripts from my Trac/Subversion site. At my previous job at large american hand held manufacturer, they had a really nice build system that was integrated with sharepoint. With it, they could schedule builds through a web page on their separate products. I was pretty amazed by it and it seemed so complex. But now I have a tool that can do the same thing for free. Hudson has some nice features: - Builds trends - How often does the build break? Does the build time increase for every build?
- Periodical builds Or when someone commits
- Test trends - Is the number of failed test increasing or decreasing over time? Does the test cover more and more code? (Clover plugin)
- Emails when a build fails - An email can be sent out when someone checks in code that breaks. Apparently it can even email those responsible for breaking the build (that I havent tested yet)
- Multiple jobs that can be shared one or several machines.
- Shell access, you can run any batch file or shell script from the builds; so it is very easy to integrate into your current build situation
- Plugins - To integrate with Trac and other bug reports; Jabber and IRC support, etc.
So far I have used it for a Java, a Python and a .NET project; and all that just in one day! Take a test drive of it (check out the webstart) and you will be pleasantry surprised.
Everyone complains that Java has their inconsistencies and then points in .NET direction and says that it is so much greater, and less inconsistencies. Somehow I can understand that java has a few of those as it has evolved since the middle of the 90's to what we have today. But I can not understand how .NET can have those as it has only evolved in the last few years.But today, I found one inconsistency that I thought was very strange. This is a very minor inconsistency, but as the two events has been developed at the same time it makes it much worse. These two events must been under development at the same time and it has probably been developed by the same team or perhaps the same people (imaging the horror).On the Form class there are two events, to notify listeners that a Form/Window has received focus/lost focus. There are two events which can be subscribed upon:Form.ActivatedForm.DeactivateNotice the difference, one is past tense and the other one isn't. C'mon these two events must have been developed at the same time, but somehow they screwed up anyhow. The more I look at the Windows.Forms API, the lesser I think of it. There are so many bad decisions in it, so many rushed things. But of course it is only a small API on top of the windows API, and they can only do so much with it.Strange, that Sun managed to a dynamic, layout managed GUI like Swing with the same APIs. It makes you think on who hired the right guys....
I wish MS could implement a little smarter/better "Go to definition" feature. Today it almost works as it should. The "Go to definition" feature is used to go to the row where something is defined (a method, a variable, etc). Which is very handy if you are maintaining a project without any code documentation at all. But unfortunately the function will be confused if there are two methods that are named the same, but have different arguments. (It is called method overloading) Visual Studio 2005 is an "ok" IDE, but it is no way near Eclipse. With VS2005, it will instead of moving the cursor to the method, it will move focus to a "Find symbol results" view where it displays those methods that have the same name. VS2005 could very easily look into the code and find out the type of method arguments and move focus to the method I wanted to see. But apparently it can not distinguish between an int and an ArrayList.Try the below code in Eclipse and VS2005, and try to go the correct method that is used in "anotherMethod". (In Eclipse use "Open declaration"). Eclipse will move you directly to the correct method (method(int,ArrayList)), while VS2005 will just show a simple search result.public void method(int i, int j)
{
}
public void method(int i, ArrayList list)
{
}
public void otherMethod()
{
int i = 2;
int j = 2;
method(i, j);
}
public void anotherMethod()
{
int i = 2;
ArrayList list = new ArrayList();
method(i, list);
}
To me it feels like Eclipse is developed by developers for developers. VS2005 is developed by someone for developers. If they had used the IDE on a daily basis they would understand that the current "Go to definition" is not properly implemented. They should be able to do a better implementation than this semi solution.
Another good example of that VS2005 is not developed by developers, is the lack of unit testing understanding in VS2005, which I already blogged about.
I really love object orientation (OO), because it is so easy to build software using it; and it is so easy to totally screw up using it. Today I was surprised when I was trying to find out some information about the Select method in System.Windows.Forms.Control. The documentation for the Select method states what the method does and doesn't do, but it also informs what inheriting classes that does not support it. Of course, every parent class should know everything about the inheriting classes; and have documentation on everything
Excerpt from the documentation:
The Windows Forms controls in the following list are not selectable. Controls derived from controls in the list will also not be selectable. * Label * Panel * GroupBox * PictureBox * ProgressBar * Splitter * LinkLabel (when there is no link present in the control)C'mon, why put the Select method in the Control class if they know that many inheriting classes will not implement it at all. This solution/idea reeks of bad design! If a Control does not support a certain functionality, then that class should not have a method pretending to support the functionality. But this is not the first time I found a similar problem with the "design" of Windows Forms, so I will stop whining here....
I've always liked unit testing as it makes my job as a software developer much easier. But the unit testing features of Visual Studio 2005 makes me very frustrated and tired of writing unit tests.There are two big key issues when using unit testing in VS2005.- When I have executed a test and it fails; it will show up in a list with a red icon. When I double click on the failing row/test it will show a report stating what went wrong. Tell me something I don't know, and move the focus to the failed assertion.
- When I have fixed a bug in the project under test, I would like to re-run the test. In the "Test results" window I can choose "Rerun original test". When I click on it, it will re-run the test with the old code; and the test will fail again even if I fixed the bug. What happened, didn't I fix the code??
- What the h**l is "Assert.Fail failed."?
Visual Studio 2005:
Eclipse:
Issue 1Since the test report window has already displayed that the test fail, I'm not interested in a report stating that the test failed, I know already that the test failed and (hopefully) the reason for it. What I am interested in is which assertion failed and where it is.
In VS2005 I have to do the following to get to the assertion:- Double click the failure in the "Test results" window.
- Find the row number by reading the text in the stack trace section. Add row number to memory.
- Open the unit testing code file.
- Go to the row found in step 2
- Fix the assertion
In Eclipse it is so much easier:- Click on the failure in the "Junit" window.
- Double click on the "AssertionFailed" in the "Failure trace"
- Fix the assertion
C'mon; 4 steps and many user interactions involving remembering trivial values to show the failed assertion. It is really frustrating to do it whenever something fails. If something is frustrating and takes time, the developer will stop doing it; thus stop unit testing the software. There is no context menu item to go to the failed assertion, only to go to the begining of the test method. With test cases that can be long, it is not so easy to find the failed assertion. Below is the test report that is shown when the user double clicks on the failure. 
Issue 2
I have one project that contains the production code, and one test project next to it as I don't want to mix production code with test code. I've created a test project, added a reference to the production project, and verified that the test project depended on the main project. The test project can access the production classes, so far everything is fine.
But the problem comes when one of the tests fails because of a bug in a production class. When I update the code in the production project, and want to debug the last failed test I click on the "Debug original test". Sure the debugger starts, but the problem is that VS2005 forgot to build the whole solution including the production project. Instead of rebuilding the production project it will only rerun the test. The test will of course fail again, and I will be sitting there wondering if my fix didn't do anything. This has happen to many times, and I've wasted numerous minutes before realising that I must manually build the solution.
Perhaps I'm not using the features correctly, and MS has another view on old test results. Maybe test results should be saved every time a test is run. But for me test results has a very limited lifetime, as soon as I've fixed an error; I don't care about the results prior to the fix.
This does not happen in Eclipse, the minute that I've updated the code I can re-run the test by clicking on "Re-run Last Test - Failures first". No rebuild needed, no time spent wondering why a fix doesn't work.
Issue 3 (Minor)
I just saw this when writing this blog. How can an Assert.Fail() fail? The failure text states that the Assert.Fail() itself failed, to me that is not correct. The test failed itself, and should perhaps say "Failed due to an Assert.Fail() call". Unfortunately Eclipse is not much better as it states "AssertionFailedError" for a fail() call, but still that is better than VS2005.
Opinion
The VS2005 unit testing features are not user friendly, they don't help the user as good as they could. Sometimes a tool with a bad feature implementation is worse than a tool without the feature. Perhaps MS can improve the usability in VS2005, and make it easier for us developer that wants to utilise unit testing. It seems that the above design misstakes must be developed by people who doesn't practice unit testing.