In addition to symbols (described in Use symbols to pass dynamic information), FitNesse supports simpler parameters called markup variables. Markup variables are similar to preprocessing macros, and we can use them to parameterise a test page (or a set of pages). For example, if the tests depend on a file system path or URL of some internal test server, which can change in the future, we can store this URL in a markup variable. When the URL changes, we just need to modify it in one place.
We can specify markup variables with the !define directive.
You have already used variables to specify the test runner and
DLL path. Once defined, variables can be used anywhere in the wiki page by
enclosing the variable name in
${}.
Here is an example that shows how a variable might be used in the
PurchaseTicket test:
5 !define username {john}
19 |Purchase Ticket|
20 |Player|${username}|Deposits|100|dollars with card|4111111111111111|and expiry date|01/12|
21 |Player|${username}|has|100|dollars|
22 |Player|${username}|buys a ticket with numbers|1,3,4,5,8,10| for |10| dollars for draw on |01/01/2008|
You can use markup variables in combination with the !include
directive to parameterise included pages. You can even include the same page
several times, changing variable values in between. See
http://fitnesse.org/FitNesse.UserGuide.ParameterizedIncludes for an example.
![]() | What is the difference between variables and symbols? |
|---|---|
Markup variables are processed by the wiki, before running tests. Symbols are processed by the FIT engine while running tests. Because of that, variables can be used even as a part of cell content. This will not work: |StringFixture| |field|field?| |acrobat <<reader|acrobat reader| but you can use a markup variable: |StringFixture|
|field|field?|
|acrobat ${reader}|acrobat reader|Symbols are also available to fixtures at runtime, and variables are not. |

![[Tip]](../images/resources/tip.png)


