各位大神好:
小弟目前在寫robot framework,想要操作2個android裝置(不用同時沒關係),前置作業和操作步驟如下:
Pre-condition:
1.先用Android Studio創建2台android模擬器(假設一台叫"device1",另一台叫"device1")
2.在device1和device2都安裝一個app(貴公司自己建的app)
Steps:
1.用"Open Application"先打開device1的app
2.再Login app
3.接著再用"Open Application"打開device2的app
4.再Login app
問題來了,這時候我想繼續回頭操作device1的app,發現找不到相關的Keyword可以繼續操作device1的app(在device1不重新開啟一個新app的情況下),如果繼續寫相關case,都會一直在device2下操作,如果用"Open Application",就會關閉原本已經在device1登入的app,請問各位大大是否有解?
沒用過這東西
不過應該有辦法將測試分別用變數儲存吧
你該不會是直接覆蓋掉前一個之類的吧?
無聊玩的
多個 browser 測試
index.robot
*** Settings ***
Documentation A test suite with a single test for valid login.
...
... This test has a workflow that is created using keywords in
... the imported resource file.
Resource resource.robot
*** Test Cases ***
Valid Login
Open Browser1 To Login Page
Open Browser2 To Login Page
Input Username demo Web1
Input Username browser2 Web2
Input Password mode Web1
Input Password mode Web2
Submit Credentials Web1
Submit Credentials Web2
Welcome Page Should Be Open Web1
Login Should Have Failed Web2
Close Test Browser Web1
Close Test Browser Web2
resource.robot
*** Settings ***
Documentation A resource file with reusable keywords and variables.
...
... The system specific keywords created here form our own
... domain specific language. They utilize keywords provided
... by the imported SeleniumLibrary.
Library SeleniumLibrary
*** Variables ***
${SERVER} localhost:7272
${BROWSER} Firefox
${DELAY} 0.25
${VALID USER} demo
${VALID PASSWORD} mode
${LOGIN URL} http://${SERVER}/
${WELCOME URL} http://${SERVER}/welcome.html
${ERROR URL} http://${SERVER}/error.html
*** Keywords ***
Open Browser1 To Login Page
Open Browser ${LOGIN URL} ${BROWSER} alias=Web1
Set Selenium Speed ${DELAY}
Login Page Should Be Open
Open Browser2 To Login Page
Open Browser ${LOGIN URL} ${BROWSER} alias=Web2
Set Window Position 950 10
Set Selenium Speed ${DELAY}
Login Page Should Be Open
Login Page Should Be Open
Title Should Be Login Page
Go To Login Page
Go To ${LOGIN URL}
Login Page Should Be Open
Input Username
[Arguments] ${username} ${web}
switch browser ${web}
Input Text username_field ${username}
Input Password
[Arguments] ${password} ${web}
switch browser ${web}
Input Text password_field ${password}
Submit Credentials
[Arguments] ${web}
switch browser ${web}
Click Button login_button
Welcome Page Should Be Open
[Arguments] ${web}
switch browser ${web}
Location Should Be ${WELCOME URL}
Title Should Be Welcome Page
Close Test Browser
[Arguments] ${web}
switch browser ${web}
Close Browser
Login Should Have Failed
[Arguments] ${web}
switch browser ${web}
Location Should Be ${ERROR URL}
Title Should Be Error Page