Robô Quadro que está errado com o meu recuo?
-
02-01-2020 - |
Pergunta
Eu li que você pode usar um tubos separados formato de Robô Framework de testes, mas no meu 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
Quando executou o código oferece uma variedade de erros:
[ 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'.
Ele também me diz que cada linha de meus casos de teste (incluindo o nome do caso de teste) para conter palavras-chave.
Eu, erradamente, formatei meu scripts de teste, ou estou mal informado sobre tubos separados formatação?
Editar - Em outro pergunta a resposta foi dada usando este formato
Obrigado antecipadamente.
Solução
Você deve ter espaços entre os tubos.Considere esta linha:
|| Open Browser | ${LOGIN URL} | ${BROWSER}
você precisa mudar a este:
| | Open Browser | ${LOGIN URL} | ${BROWSER}
A partir do manual do utilizador:
Tubos e separadas por um espaço linhas são reconhecidos pelo obrigatória líder cano, mas o tubo no final da linha é opcional.Deve sempre haver pelo menos um espaço em ambos os lados do tubo (exceto no início e fim), mas não há necessidade de alinhar os tubos diferente se ele torna os dados mais claros.