Search the web
Sign In
New User? Sign Up
fitnesse
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Override DoRows - a help request as I don't understand the resulting   Message List  
Reply | Forward Message #13438 of 14131 |
Re: [fitnesse] Re: Override DoRows - a help request as I don't understand the resulting behaviour

Cell operator aka cell handler is what you want.  This has never been well documented so now's a good time :-)

Before I start, can you tell me what version you're using?  The reason I ask is that the cell handler concept of FitNesse.NET has had major changes (and been renamed 'cell operator') in my latest version.  So I'll explain what to do for your version first and then update the documentation for the other version next.

In summary, the concept is that you write a 'plug-in' class that can examine the contents of each cell before a fixture uses it and change the default behavior.  For example, there is a numeric cell operator/handler that looks for cells like '<5' and changes the default comparison behavior from string equality to numeric less than.  So you can write a class that looks for the basedate+/-ax[ +/-bx][+/ -cx] pattern and changes the default behavior to do the date arithmetic. (And hopefully once we get it working, you'll be able to contribute it to the code base!)
--
Cheers,
Mike Stockdale

fitSharp
FitNesse.NET
Syterra Software Inc.

tomerrington@... wrote:


Hi Mike,

thanks for the suggestion, but as I read it you are saying that I won't get a generic solution by attempting my own row handling this way.

Did I see somewhere that the use of expressions like !today+x has been included in the latest FitNesse? This is moving towards what I am trying to achieve, but I don't find that !today is often very useful as a test date (my test doesn't know what it is or what it it relates to..).

As I do a lot of testing around fixed dates (the UK tax year, for instance, ends on 5th April - don't ask why) I wanted to be able to set a reference date, then hang all the other test dates off that.
A full test of a tax year would really entail 2 tax year ends, covering, including setup and tidying up, about 16 months. I could hard-code a date onto each test page in my cycle, but I would much rather set a date once and have it roll forward. Then, for instance, if I wanted to test a different tax year, I only change one date.
Is there a more general discussion to be had here around the re-usability of date based tests?

Anyway, so I have a C# function that can cope with expressions like basedate+/-ax[ +/-bx][+/ -cx] etc. where abc are numeric and x is one of [ymwd].

The plan was then, originally, to have something like this, where the code does a search and replace for "basedate":

!define babyduedate {24/08/2009}

!|myNameSpace. myTest|
|set basedate to|${babyduedate} |
|check|maternity pay available from|basedate- 11w|
|check|maternity pay payable to|basedate+ 39w|

Or perhaps this, which would entail a slightly more interesting search algorithm:

!define babyduedate {24/08/2009}

!|myNameSpace. myTest|${ babyduedate} |
|check|maternity pay available from|${babyduedate} -11w|
|check|maternity pay payable to|${babyduedate} +39w|

I hope that makes sense.
So...would a cell operator be of more use to me (and what is a cell operator anyway!)?

Thanks,
Tom.

--- In fitnesse@yahoogroup s.com, Mike Stockdale <jediwhale@. ..> wrote:
>
> The problem with your first attempt is it tries to parse the HTML for a
> set of rows, and the parser expects a full table. That's why it says
> 'missing table tag'. The problem with the second attempt is that you
> need to modify the body of each cell, you can't modify the body of the rows.
>
> So you could do something like:
> for each row in rows
> for each cell in row
> cell.SetBody( doStuff.modify( cell.Body)
>
> However, you will have problems with some of the flow fixture types that
> override DoTable and don't call DoRows as they handle the navigation of
> the table structure in their own special way.
>
> What are you specifically trying to accomplish? There may be a better
> approach, perhaps using cell operators.
> --
> Cheers,
> Mike Stockdale
>
> /fit/Sharp <http://www.syterra. com/FitSharp. html>
> FitNesse.NET <http://www.syterra. com/FitnesseDotN et.html>
> Syterra Software Inc. <http://www.syterra. com>
>





Mon Jul 13, 2009 6:39 pm

jediwhale
Offline Offline
Send Email Send Email

Forward
Message #13438 of 14131 |
Expand Messages Author Sort by Date

I am attempting to override DoRows to pre-process data in tables (initially with DoFixture, but will want to extend to others), but obviously don't understand...
tomerrington@...
tomerrington...
Offline Send Email
Jul 12, 2009
10:52 pm

The problem with your first attempt is it tries to parse the HTML for a set of rows, and the parser expects a full table. That's why it says 'missing table...
Mike Stockdale
jediwhale
Offline Send Email
Jul 13, 2009
2:26 am

Hi Mike, thanks for the suggestion, but as I read it you are saying that I won't get a generic solution by attempting my own row handling this way. Did I see...
tomerrington@...
tomerrington...
Offline Send Email
Jul 13, 2009
2:22 pm

Cell operator aka cell handler is what you want. This has never been well documented so now's a good time :-) Before I start, can you tell me what version...
Mike Stockdale
jediwhale
Offline Send Email
Jul 13, 2009
6:40 pm

Ok Mike, sounds like a plan! I would be more than happy to contribute if it would be found useful. We are just standardising on FitNesse 20090513, though would...
tomerrington@...
tomerrington...
Offline Send Email
Jul 14, 2009
12:56 pm

Here's how to get started: http://www.syterra.com/FitnesseDotNet/WriteYourOwnCellHandler.html -- Cheers, Mike Stockdale /fit/Sharp...
Mike Stockdale
jediwhale
Offline Send Email
Jul 19, 2009
10:42 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help