robotframework

In Robot Framework, how to perform data-driven testing by creating a separate test case for each line of data in a text file?

时光总嘲笑我的痴心妄想 提交于 2019-12-01 05:31:17
问题 In Robot Framework, we can use Test Template to perform data-driven testing. However, in this method, the number of test cases are fixed. We are not able to add new test cases on-the-fly. Let's say I have a CSV text file, data.txt : data-1a, data-1b, data-1c data-2a, data-2b, data-2c .... data-Na, data-Nb, data-Nc The number of lines in the CSV file will change from time to time. In my Robot Framework test case file, I will read this CSV file. Let's say there are N lines of data in that file,

“Run Keyword If” and setting a variable

与世无争的帅哥 提交于 2019-12-01 04:51:38
问题 The following code doesn't work. I want to set a variable if a condition is true. Run Keyword If ${MAC} == 110299160221421 ${device_serial}= set variable ${device_serial_1} I get the error: No keyword with name '=' found This is working but doesn't change a variable. Run Keyword If ${MAC} == 110299160221421 Log to console 111 回答1: Run keyword if returns the result of the keyword that you're running. So, like with any other keyword, you put a variable in the first column if you want to save

How to get and set the default output directory in Robot Framework(Ride) in Run time

隐身守侯 提交于 2019-12-01 01:29:58
I would like to move all my output files to a custom location, to a Run directory created based on Date time during Run time. The output folder by datetime is created in the TestSetup I have function "Process_Output_files" which will move the files to the Run folder(Run1,Run2,Run3 Folders). I have tried using the argument-d and used the function "Process_Output_files" as suite tear down to move the output files to the respective Run directory. But I get the following error "The process cannot access the file because it is being used by another process". I know this is because the Robot

robot framework: Reuse existing Browser Window between Tests

老子叫甜甜 提交于 2019-12-01 00:28:48
I would like to run tests with pybot , then run more tests with pybot using the same browser window that the first pybot opened. So… pybot test1.txt #opens browser window and runs test1.txt and doesn't close the window #pybot completes execution pybot test2.txt #uses the same browser window from test1 #pybot completes execution pybot test3.txt #uses the same browser window from test1 #pybot completes execution can't figure out how to do that…. I've tried Open Browser www.mysite.com alias=1 in the first test and then Switch Browser 1 in the others, but they just error with No browser is open A

How to get and set the default output directory in Robot Framework(Ride) in Run time

自闭症网瘾萝莉.ら 提交于 2019-11-30 20:50:40
问题 I would like to move all my output files to a custom location, to a Run directory created based on Date time during Run time. The output folder by datetime is created in the TestSetup I have function "Process_Output_files" which will move the files to the Run folder(Run1,Run2,Run3 Folders). I have tried using the argument-d and used the function "Process_Output_files" as suite tear down to move the output files to the respective Run directory. But I get the following error "The process cannot

Robot Framework :- Cannot Open Chrome from Existing Chrome Profile

邮差的信 提交于 2019-11-30 20:33:40
问题 I am trying to Learn Robot Framework. I have already worked on Selenium Webdriver. I was trying to open the Chrome Browser from an Exiting Profile using Create Webdriver Keyword. However i am not able to do . It Seems that Robot Framework Opens a new Chrome Profile Everytime. Here is the Code that i got after goggling, but this is not opening Chrome from the User data folder that i prefer. Any Suggestions or Ideas this can be achieved. Open Chrome Using Create WebDriver Keyword [Tags] chrome

How to load a json data file into a variable in robot framework?

流过昼夜 提交于 2019-11-30 20:07:01
I Am trying to load a json data file into a variable directly in Robot Framework. Can anyone please elaborate with an e.g. giving the exact syntax as to how to do it? Thanks in advance :) One way would be to use the Get File keyword from the OperatingSystem library, and then use the built-in Evaluate keyword to convert it to a python object. For example, consider a file named example.json with the following contents: { "firstname": "Inigo", "lastname": "Montoya" } You can log the name with something like this: *** Settings *** | Library | OperatingSystem *** Test Cases *** | Example of how to

How to add headers for CreateSession in robot framework HTTP requests library

眉间皱痕 提交于 2019-11-30 18:56:38
问题 I am using the requests library in Robot framework provided at this github link. The documentation implies that if can send custom headers by doing CreateSession <url> headers={'header1':'value1'} .... However, when I do that I get an error "ValueError: need more than 1 value to unpack" This works CreateSession SendCustomHeader http://myhost.com verify=False This does not CreateSession SendCustomHeader http://myhost.com headers={'header1':'value1'} verify=False I tried with various

How to include Java test libraries in a Python based Robot framework

▼魔方 西西 提交于 2019-11-30 16:13:44
I am trying to get a Robot framework in place based on Python. On one side of the test block box is a Python simulator for which I have written test libraries to interact with. On the other side there is a Java library. I have the following questions on how to interact with Java classes from within the Python based Robot framework: Option A: Robot Framework (based on Python) includes both the Python test libraries and Java test libraries seamlessly. After reading through the Robot documentation I do not believe this is possible? Or maybe it’s possible and not clearly mentioned anywhere? My

Logging HTML requests in robot framework

喜你入骨 提交于 2019-11-30 16:11:09
I have been struggling to find much information to go along with this so I have turned here for help. I am running UI tests of a web app using robot framework. When a test fails I want a log of the HTML requests so I can look back and see what failed, i.e. things not loading, 500 errors etc. To this point I haven't managed to find something within the robot framework or selenium? Another option is to see if there is a python library for logging this sort of thing or whether it would be a reasonable task to create one? I have also looked into using autoit it use the browsers internal network