Selenium Fitnesse bridge: how to store and echo a variable?

I am using Selenium Fitnesse Bridge Fixture to write tests in Fitnesse for Selenium. This is great because it covers ALL the features that Selenium has. However, the problem I'm running into is storing variables like in the Selenium IDE.

| ! - fixtures.SeleniumFixture -! |
| setup | http://www.google.com/ | * chrome /usr/lib/firefox-3.0.5/firefox |
| open | http://www.google.com/ | |
| storeLocation | here | |
| echo | $ {here} | |

Something as simple as this should work fine, but when I save the test, I get an error, the variable is undefined.

| storeLocation | here | |
| echo | undefined variable: here | |

It just doesn't make sense. I am defining a variable string before I iterate over it. When I run the test, I get:

| storeLocation | here | |
| echo | undefined variable: here | undefined variable: here |

The author does the same with his tests . Why won't this work for me?

+1


source to share


1 answer


The problem is Fitnesse gets confused. He thinks you are not defining a variable.

! define variable {variable}
| echo | $ {variable} | |

The way to get down to Fitnesse is to avoid the variable name by surrounding it! - - !.



| storeLocation | here | |
| echo | $ {! - here-!} | |

This will now reflect the desired answer.

| ! - fixtures.SeleniumFixture -! |
| setup | http://www.google.com/ | * chrome /usr/lib/firefox-3.0.5/firefox |
| open | http://www.google.com/ | |
| storeLocation | here | |
| echo | $ {here} | http://www.google.com |
+1


source







All Articles