如何打开和关闭应用程序并仍然记录每个测试用例? (RobotFramework/AppiumLibrary)

How to open and close the application and still logged every test case? (RobotFramework/AppiumLibrary)

我正在尝试使用 AppiumLibrary 设置机器人框架自动化。我想关闭应用程序并在每个测试用例中再次打开它,但无需再次登录。实际上,当我关闭应用程序时,应用程序会重置并要求我重新登录。我只是在 Open Application 上设置了“noReset=true”功能,但这并没有解决我的问题。有人知道怎么做吗?

***Settings***
Library     AppiumLibrary

***Keywords***
Start Session
    Set Appium Timeout  10
    Open Application    http://localhost:4723/wd/hub
    ...                 automationName=UiAutomator2
    ...                 platformName=Android
    ...                 deviceName=emulator-5554
    ...                 appPackage=br.com.app.app
    ...                 appActivity=.MainActivity
    ...                 autoGrantPermissions=true
    ...                 noReset=true
    Sleep               5

Start app
    Wait Until Page Contains               Hello

Close Session
    Capture Page Screenshot
    Close Application                      noReset=true

Close Application
    Capture Page Screenshot
    Quit Application   

Launch Application
    Open Application                     http://localhost:4723/wd/hub
    ...                                  automationName=UiAutomator2
    ...                                  platformName=Android
    ...                                  deviceName=emulator-5554
    ...                                  appPackage=br.com.app.app
    ...                                  appActivity=.MainActivity
    ...                                  autoGrantPermissions=true
    ...                                  noReset=true

***Test Cases***
See the first screen
    [Setup]          Start Session
    Start app
    Log in
    Check the first screen
    [Teardown]       Close Application

See the second screen
    [Setup]          Launch Application
    Check the first screen
    [Teardown]       Close Session

尝试在功能中同时使用 fullReset=false 和 noReset=true。这可以解决你的问题。