CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeffrey Palermo [MVP]

Software management consultant and CTO, Headspring Systems

How to use FitNesse querystring "switches" - level 300

You might have notice in the FitNesse urls, a "?test" at the end when you run a test page.  Also, when you edit a page, you are using "?edit".  There are many of these querystring switches you can use to do some interesting things.  You can see all of these by opening up the Java source:

  addResponder("edit", EditResponder.class);
  addResponder("saveData", SaveResponder.class);
  addResponder("tableWizard", TableWizardResponder.class);
  addResponder("search", SearchResponder.class);
  addResponder("searchForm", SearchFormResponder.class);
  addResponder("test", TestResponder.class);
  addResponder("suite", SuiteResponder.class);
  addResponder("proxy", SerializedPageResponder.class);
  addResponder("versions", VersionSelectionResponder.class);
  addResponder("viewVersion", VersionResponder.class);
  addResponder("rollback", RollbackResponder.class);
  addResponder("names", NameWikiPageResponder.class);
  addResponder("properties", PropertiesResponder.class);
  addResponder("saveProperties", SavePropertiesResponder.class);
  addResponder("whereUsed", WhereUsedResponder.class);
  addResponder("refactor", RefactorPageResponder.class);
  addResponder("deletePage",DeletePageResponder.class);
  addResponder("renamePage", RenamePageResponder.class);
  addResponder("movePage", MovePageResponder.class);
  addResponder("pageData", PageDataWikiPageResponder.class);
  addResponder("createDir", CreateDirectoryResponder.class);
  addResponder("upload", UploadResponder.class);
  addResponder("socketCatcher", SocketCatchingResponder.class);
  addResponder("fitClient", FitClientResponder.class);
  addResponder("deleteFile", DeleteFileResponder.class);
  addResponder("renameFile", RenameFileResponder.class);
  addResponder("deleteConfirmation",DeleteConfirmationResponder.class);
  addResponder("renameConfirmation",RenameFileConfirmationResponder.class);
  addResponder("raw", RawContentResponder.class);
  addResponder("rss", RssResponder.class);
  addResponder("import", WikiImportingResponder.class);
  addResponder("files", FileResponder.class);
  addResponder("shutdown", ShutdownResponder.class);
  addResponder("format", TestResultFormattingResponder.class);
  addResponder("symlink", SymbolicLinkResponder.class);

Some of the more interesting ones I like are rss, fitClient, and raw.  Yes, "shutdown" will actually shut down the wiki.  Use with care.

The "rss"  querystring parameter will give you an rss feed, and the "raw" parameter will spit out the exact contents of the underlying "content.txt" file.  This is the exact wiki text that the user entered.  "fitClient" is the one that interests me most because it will spit out the html tables needed to actually run the FitNesse tests offline or in a debugger.  The html is rendered to the browser, but there is a bug in the FitClientResponder class that violates a rule of an Http request, so I can't programmatically get this page with .Net code (say, the WebClient class). 

Something very interesting I've done with the "raw" switch is to pull it back into an NUnit helper class, run it through some simple translator code:

                  StringReader reader = new StringReader(wikiText);

                  string line = reader.ReadLine();

                  while(line != null)

                  {

                        line = line.Trim();

                        if(line.StartsWith("!"))

                        {

                              string row = line.Trim('!', '|');

                              this.StartTable(row);

                        }

                        else if(line.StartsWith("|"))

                        {

                              // get rid of leading and trailing "|", and split on the rest.

                              string[] columns = line.TrimStart('|').TrimEnd('|').Split('|');

                              this.AddRow(columns);

                        }

                        line = reader.ReadLine();

                  }

                  reader.Close();

 

Then, I have the html tables that allow me to create a new Parse object by passing in this html string.  Then it's trivial to execute this against the FitNesse test engine.

By the way, Google Desktop 2 is great.  I've been using it to search and find source code.  Even if the documentation is complete, or you want to dig more, Desktop search is great for finding tidbits in the source code itself (I've used MSN search as well.  They both work well).


Published Sep 19 2005, 05:24 PM by Jeffrey Palermo
Filed under:

Comments

Jeffrey Palermo said:

This technique is still working very well.
# October 5, 2005 11:26 AM

About Jeffrey Palermo

Jeffrey Palermo is a software management consultant and the CTO of Headspring Systems in Austin, TX. Jeffrey specializes in Agile coaching and helps companies double the productivity of software teams. Jeffrey is an MCSD.Net , Microsoft MVP, Certified Scrummaster, Austin .Net User Group leader, AgileAustin board member, INETA speaker, INETA Membership Mentor, Christian, husband, father, motorcyclist, Eagle Scout, U.S. Army Veteran, and Texas A&M University graduate. Check out Devlicio.us!

This Blog

Syndication