My lil Subversion Jumpstart tutorial

I'll keep it short.

  1. Get Subversion from http://subversion.tigris.org Get the binary packages for your OS for ease of installation. approx 3MB
  2. Get Mike Clark's book .

I'll just note down some of the things that I do when I set up a SVN box on my WinXP machine.

  • Run the install or unzip the zip to the [SubversionFolder] e.g. d:/subversion
  • Modify the PATH environment variable so that it includes [SubversionFolder]/bin. You can verify this via the command prompt
>svn --version
svn, version 1.4.5 (r25188)
compiled Aug 22 2007, 20:49:04
  • Create the repository. To create a repository in D:\CoderZone\svn-repos - assuming that d:\CoderZone exists
>svnadmin create /CoderZone/svn-repos
  • Now you can import a dump file e.g. if you are migrating between machines / subversion versions. e.g. if I had created a dump file from the source repository and load it into the new repository as shown below. (If you get an error like svnadmin: Expected format '3' of repository; found format '5' make sure that you dont have the old version of svnserve running. Close the process and create the repository again)
>svnadmin dump D:\CoderZone2\svn-repos > ReposDump.dmp
>svnadmin load D:\CoderZone\svn-repos < ReposDump.dmp
  • You start the subversion daemon like this
>start svnserve --daemon --root d:\CoderZone\svn-repos
  • Next we import a folder like this. e.g. if we want to check in contents of c:\work
c:\work
>svn import -m "First Check-in" svn://[SubversionRunningMachine]/[ProjectName]/trunk
  • That's it we can now checkout the contents of our project to a folder name Work2 like this
>svn co svn://[SubversionRunningMachine]/[ProjectName]/trunk Work2
  • I can add a new file to version control and check in modifications to already versioned files with
>svn add Data\templateData.xml
>svn commit -m "First Change!"

Getting FIT with Fitnesse: Getting Started

Useful links:
  1. Cory Foy does it! Fitnesse with Dotnet to suck em' into showing how to do it with Ruby as well.
  2. Ron Jeffries XP Mag article on Fitnesse with Ruby
  3. Gojko's PDF on getting Fitnesse up and running with DotNet
  4. Fitnesse Mailing List

On our way to Fitnesse
First we need to install Fitness, which will get FIT along with it. Go to http://fitnesse.org/ Click on Download. Get the full distribution zip. Next unzip it to a folder say c:\fitnesse.
Now just to be safe in case you have something running on the default port 80. Edit the run.bat batch file in the c:\fitnesse folder. Modify it as shown below to use a different port.

java -cp fitnesse.jar fitnesse.FitNesse %1 %2 %3 %4 %5 -p 2345
pause
That's it. Double click / Launch run.bat.

L:\fitnesse>java -cp fitnesse.jar fitnesse.FitNesse -p 2345
FitNesse (20070619) Started...
port: 2345
root page: fitnesse.wiki.FileSystemPage at ./FitNesseRoot
logger: none
authenticator: fitnesse.authentication.PromiscuousAuthenticator
html page factory: fitnesse.html.HtmlPageFactory
page version expiration set to 14 days.
PromiscuousAuthenticator... hmm wonder why its named like that.. but let us go on.

Fire up a browser to http://localhost:2345/
You should see the FrontPage with the Fitnesse Gauge Pointing to Green. Good work!

Does it work?

By default, Fitnesse is set to work with Java. So mustering the little bits of java that I know, lets forge ahead. Hmm.. lil reading up the wiki documentation.. Lets try the 2 Min Example
Next I spent a good 30 minutes, wondering how do I start typing that table. How do I create a blank page? I'll cut right to the chase. Just go to the address bar, think of a good name that is a WikiWord.. I chose 'GrandEntraceToMyAcceptanceTests'.. type in
http://localhost:2345/GrandEntraceToMyAcceptanceTests
and... (Right click and open the image in a new window/tab to make it readable)

Quick Batman.. click on the 'create this page' link. Its simple when you know how. And soon you should be on the 'Edit Page' screen, with a large textbox. Lets master page creation.. we don't want all our tests on one page. Type in ColumnFixtureSample and hit the Save button at the bottom of the page. You're back to the Entrance page but this time it has a set of buttons on the left and the content area shows ColumnFixtureSample?

Click on the ? link to edit the ColumnFixtureSample page.. welcome to the land of wikis.

Now lets masquerade as an excel-happy customer. He writes the following in the spreadsheet
Starting from an initial credit of 500, anytime the person spends money, the balance should be deducted by the same amount.


Copy this range and switch back to the wiki page in edit mode.
Enter the name of the java Fixture class that should be called as the first line. Press Enter. Paste the contents of the excel range too. You should see
com.gishu.trial.TestFixture
moneySpent balance?
100 400
100 300
Press the nifty 'Spreadsheet to Fitnesse' button at the bottom and ...
!|com.gishu.trial.TestFixture|
|moneySpent|balance?|

|100|400|

|100|300|
We have the fitnesse table ready. Hit Save.
Now to make this page testable, we need to set the 'Test' page property. Click on 'Properties' on the left panel. Check the 'Test' checkbox in the Actions group and click 'Save Properties'. You should now see that the page has a Test button at the top of the left panel.
Lets try it.. and we see a dirty yellow telling us we had an Exception - "Could not find fixture: com.gishu.trial.TestFixture."
But that was expected.
Let me code the java fixture up in L:\Gishu\Java\com\gishu\trial\TestFixture.java
package com.gishu.trial;

import fit.ColumnFixture;

public class TestFixture extends ColumnFixture
{
public int moneySpent;
public int balance()
{
UnderCoverDomainClass obDomainClass = new UnderCoverDomainClass();
obDomainClass.spend(moneySpent);
return obDomainClass.getBalance();
}
}

// class from the application source
class UnderCoverDomainClass
{
private int m_iBalance;
public void spend(int iMoneySpent)
{
m_iBalance -= iMoneySpent;
}
public int getBalance()
{
return m_iBalance;
}
}
Code is pretty simple. The test fixture has public data members for each column in the wiki fixture table, whose value is set to cell value. Every column name that ends in a ? signifies a method call, the value in the cell is the expected return value of that method. So the first row, would set moneySpent to 100 and then verify if the balance() method returns 400.
The fixture methods are supposed to call the application code to be verified. Here represented by the UnderCoverDomainClass.

Compile with...
L:\Gishu\Java\com\gishu\trial>javac -classpath l:\fitnesse\fitnesse.jar TestFixture.java
Now we need to tell fitnesse where to find our class files. Looks like this page has what we need.
So we edit our ColumnFixtureSample page to

!path L:\Gishu\Java

!|com.gishu.trial.TestFixture|
|moneySpent|balance?|
|100|400|
|100|300|
Save and click on Test again and we see that the tests have failed, with expected and actual values. The set classpath is being shown.

We seem to be getting a value of -100 as the balance always. Well.. we have not given the default credit of 500. Initialize the m_iBalance variable in UnderCoverDomainClass to 500. Save and Recompile. Lets run our tests again. Click Test again. This time, the first test passes. Second test returned 400 instead of 300.
Something is amiss.. Let me re-read the page on FixtureCode Aha! Test isolation. Read the section 'What that call to StaticGame is for'
So we need a singleton instance of UnderCoverDomainClass to be operated on by each row. So add another class

class SingletonDelivery
{
private static UnderCoverDomainClass m_obInstance = null;
public static UnderCoverDomainClass getInstance()
{
if (m_obInstance == null)
{
m_obInstance = new UnderCoverDomainClass();
}
return m_obInstance;
}
}
Update the balance method in the fixture to use SingletonDelivery.getInstance() instead of a new UnderCoverDomainClass(). Save and Recompile. Run Tests. Woo hoo!!!

And there we have it.
Next I'm gonna try writing some acceptance tests for a small Ruby on Rails project that I am gonna work on. But thats the next post...

Agile Estimating and Planning - Mike Cohn

Book

Key take-aways from this book..

How to use something that sounds as childish as 'story points' and make it work better than the traditional GANTT chart sequential task based model ? Separate size from duration.
How to prioritize stories or themes ?
How do you know and explain Story#1 is 'more value to the customer'?
How to separate stories into must-haves / linear / exciters ?
How to plan releases and iterations ? How to track em ?
How to make an estimate of initial velocity and how to get better at it with iterations under your belt?

In short this was my missing piece of the agile jigsaw. Gonna read it again soon when I plan something new.

Recommended Read. Recommended Buy.

Compare (and merge?) excel files with Beyond Compare

Another note to myself.

My main app - Beyond Compare, a file diff-merge utility from Scooter Software(and a really good one at that) has some spiffy rules that let you 'do the diff' on versions of an excel document.
You can compare (and it seems now you have merge as well) excel as well as word files. I haven't really compared word docs yet but xls diffs work ... well!

All you gotta do is download the rules (as a zip).
  • Unzip it to your Beyond Compare install Directory.. MSExcel folder for the xls diff rule.
  • Run Beyond Compare.
  • Main Menu > Tools > Import Rules. Select the rule file under the MSExcel folder.
  • Select the two xls files in Windows Explorer, right click and choose Compare! voila!
There are a lot of other goodies available here