简体   繁体   English

打开浏览器选项卡以执行机器人框架测试用例

[英]Open browser tabs to execute robot framework test case

I have a doubt regarding RobotFramework(RF) so posting this to Stackoverflow, I have to test 4 website using RF, and each run parallely at the same time using pabot.我对 RobotFramework(RF) 有疑问,因此将其发布到 Stackoverflow,我必须使用 RF 测试 4 个网站,并且每个网站同时使用 pabot 并行运行。 So i reached out to a point where i want same session cookies to be used for all the 4 websites, but in RF code that i wrote each time when the test case ends it closes the browser so clearing session cookie, So my concern is that, is there any way i can test all this 4 website in same browser with same session cookie and ran in different tabs at the same time.所以我达到了一个点,我想要相同的 session cookies 用于所有 4 个网站,但是在我每次编写的 RF 代码中,当测试用例结束时它会关闭浏览器,因此清除 Z21D6F40CFB,0250A 所以我担心的是那个 5724 ,有什么方法可以让我在同一浏览器中使用相同的 session cookie 测试所有这 4 个网站,并同时在不同的选项卡中运行。

or in short Is there any way i can use same session cookie for all the 4 test suites running parallelly或者简而言之,我有什么办法可以为所有 4 个并行运行的测试套件使用相同的 session cookie

You should add a Suite Setup and a Suite Teardown .您应该添加Suite Setup 和 Suite Teardown In the Suite Setup open the browser, in the Suite Teardown close the browser.在 Suite Setup 中打开浏览器,在 Suite Teardown 中关闭浏览器。 In between the two run your four test cases for the four different websites in the same session sequentially.在两者之间,依次为同一个 session 中的四个不同网站运行四个测试用例。

Here is what I mean:这就是我的意思:

*** Settings ***
Library           SeleniumLibrary
Suite Setup       Open Browser    https://stackoverflow.com/    Firefox     
Suite Teardown    Close Browser

*** Test Cases ***
Test Website 1
    Go To     https://meta.stackoverflow.com/
    Sleep    5 seconds
    Log    Do test with same session cookies.

Test Website 2
    Go To     https://meta.stackexchange.com/
    Sleep    5 seconds
    Log    Do test with same session cookies.

Test Website 3
    Go To     https://gardening.stackexchange.com/
    Sleep    5 seconds
    Log    Do test with same session cookies.

Test Website 4
    Go To     https://gardening.meta.stackexchange.com/
    Sleep    5 seconds
    Log    Do test with same session cookies.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM