Pregunta

Leí que puede usar un Formato separado por tuberías para pruebas de marcos de robot, pero en mi código:

*** Settings ***
| Documentation | A test suite with a single test for valid login.
| Library | Selenium2Library
| Resource | AdminResource.txt

*** Variables ***
| ${LOGIN URL} | http://local.econnect-admin.com/
| ${BROWSER} | ff

| ${Login button} | xpath=//body/div[2]/div/div[2]/div[2]/div/form/fieldset/div[3]/button

*** Test Cases ***
| Valid Login
|| Open Browser To Login Page
|| Input Text | a11y-username | username
|| Input Text | a11y-password | password
|| Click Log in
|| Welcome Page Should Be Open

*** Keywords ***
| Open Browser To Login Page
|| Open Browser | ${LOGIN URL} | ${BROWSER}
|| Maximize Browser Window
|| Wait Until Page Contains Element | ${Login button} | 5s

| Click Log in
|| Click Element | ${Login button}

| Welcome Page Should Be Open
|| Location Should Be | ${LOGIN URL}
|| Wait Until Page Contains | Accounts | 5s
|| Page Should Contain | Accounts

Cuando corrió el código da una variedad de errores:

[ ERROR ] Error in file 'C:\Python\AdminTests\test.txt': Setting variable '|${LOGIN URL} | http://local.econnect-admin.com/' failed: Invalid variable name '|${LOGIN URL} | http://local.econnect-admin.com/'.
[ ERROR ] Error in file 'C:\Python\AdminTests\test.txt': Setting variable '|${BROWSER} | ff' failed: Invalid variable name '|${BROWSER} | ff'.
[ ERROR ] Error in file 'C:\Python\AdminTests\test.txt': Setting variable '|${Login button} | xpath=//body/div[2]/div/div[2]/div[2]/div/form/fieldset/div[3]/button' failed: Invalid variable name '|${Login button} | xpath=//body/div[2]/div/div[2]/div[2]/div/form/fieldset/div[3]/button'.

También me dice que cada línea de mis casos de prueba (incluido el nombre del caso de prueba) contiene a las palabras clave.

¿He formate incorrectamente mis scripts de prueba, o estoy mal informado sobre el formato separado por tuberías?

Editar - en otra Pregunta La respuesta se le dio usando este formato

gracias de antemano.

¿Fue útil?

Solución

Debe tener espacios entre las tuberías.Considere esta línea:

|| Open Browser | ${LOGIN URL} | ${BROWSER}

Necesitas cambiarlo a esto:

| | Open Browser | ${LOGIN URL} | ${BROWSER}

de la guía del usuario:

Las líneas separadas de tuberías y espacio son reconocidas por el líder obligatorio Tubería, pero la tubería al final de la línea es opcional.Debería siempre sea al menos un espacio en ambos lados de la tubería (excepto en el principio y final), pero no hay necesidad de alinear las tuberías distintas de Si hace más claros los datos.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top