How to define variables in non-technical style

246 views Asked by At

We actually use variable definition like this in FitNesse:

!define variable{variable_value}

How could I do this with a fixture or in any other way that fits more into the convention of writing tests using tables?

1

There are 1 answers

0
Dan Woodward On BEST ANSWER

It's important to understand the differences between Variables and Symbols in FitNesse and the relationship to tables.

Variables are defined so that they render before the page executes a test. The best use for variables is when you want to "hard" code a value that you are going to use frequently in a test and you know in advance. Variables also inherited by child pages, so you can set a value and reuse it.

But there is only one syntax for defining variables.

Symbols are defined at test execution time and are done within tables. You would need a method that echoes or returns whatever you are sending to it, and that will define a value at runtime that will be used whenever referenced in the test.

I've written more about this here: http://whotestedthis.squarespace.com/journal/2011/3/15/symbols-and-variables-in-fitnesse.html

See http://www.fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.WritingAcceptanceTests.SliM.SymbolsInTables for more about Symbols. And http://www.fitnesse.org/FitNesse.UserGuide.FixtureGallery.ImportantConcepts.MarkupVariables for more about variables.