Pregunta

Estoy usando Fijación de puente Selenium Fitnesse para escribir pruebas en Fitnesse para el selenio. Es genial porque cubre TODOS las funciones que tiene Selenium. Sin embargo, el problema con el que me encuentro es almacenar variables como lo haría en 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} |  |

Algo tan simple como esto debería funcionar bien, pero cuando guardo la prueba me sale un error, variable indefinida.

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

Esto simplemente no tiene sentido. Estoy definiendo la variable la línea antes de repetirla. Cuando ejecuto la prueba, obtengo:

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

El autor está haciendo lo mismo con sus pruebas . ¿Por qué esto no funciona para mí?

¿Fue útil?

Solución

El problema es que Fitnesse se está confundiendo. Piensa que no estás definiendo una variable.

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

¡La forma de evitar la confusión de Fitnesse es escapar del nombre de la variable rodeándolo con! - - !.

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

Esto ahora hará eco de la respuesta deseada.

| !- 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 |
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top