Post

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

By Lisa Crispin
My teammates Maykel Suarez, J.P. Erkelens and Eddy Lara ought to be the ones blogging about this as they come up with these cool ideas, but I have the time and the inclination so I will. I hope they’ll read this and correct any errors I make.
I’ve used FitNesse since 2003 and obviously have not learned enough up to now!
We want our FitNesse tests to be DRY (Don’t repeat yourself), easy to maintain and easy to read and understand. Maykel and I were pairing on some FitNesse/SWAT tests this morning and found we needed the same test steps in more than one place. Maykel created this page under our “HelperMacro” area. Each FitNesse variable contains a SWAT test table.
!define NavigateToRatingScale (
!|SWAT |
|StimulateElement|Expression|

innerHtml:Performance Management;onclick:USGPM|onclick|A|
|StimulateElement|Expression|innerHtml:Rating Scale |onclick|A|
)
!define NavigateToAddChangeRatingScale (${NavigateToRatingScale}
!|SWAT|
|StimulateElement|Expression|
innerHTML:Overall Review|onclick|A|
)
!define InputNumberOfLevels (
!|SWAT|
|SetElementAttribute|
Expression|Id:txtLevelNums|value |${NumberOfLevels}|INPUT|
|StimulateElement |Expression|Id:txtLevelNums|onchange|INPUT|
)
These are ‘macros’ defined as variables. Cool, huh? Notice that the second one, NavigateToAddChangeRatingScale, uses the first one, NavigateToRatingScale.

Here are examples of how we used these in test pages. First we include the page at the top of the test page;
!*> includes
!include -c

Source: http://lisacrispin.com/2009/07/28/a-different-approach-to-fitnesse-macros/

Category: agile testing, Uncategorized, fitnesse, whole team approach

Você também pode querer ler

Comments are off for this post.