robotframework

使用Robotframework做自动化WEB测试教程连载(一)——robotframework介绍

会有一股神秘感。 提交于 2019-12-10 04:37:09
Robot Framework是一个通用的关键字驱动自动化测试框架,是开源软件。主要用于“验收测试”和“验收测试驱动开发(ATDD)” 。 它使用的是表格式的测试数据语法,并且实现了关键字驱动测试策略。其测试能力可以使用测试库进行扩展,测试库可以使用Python或Java方法进行编写,并且用户可以从现有的关键字中扩展出新的关键字。 测试用例以HTML,纯文本或TSV(制表符分隔的一系列值)文件存储。通过测试库中实现的关键字驱动被测软件。 Robot Framework灵活且易于扩展。它非常适合测试有不同接口的复杂软件:用户接口、命令行,Web服务,专有的编程接口等。 Robot Framework官方网站:http://robotframework.org/ Robot Framework官方文档:http://robotframework.org/robotframework/ Robot Framework 源码:https://github.com/robotframework/robotframework 来源: oschina 链接: https://my.oschina.net/u/199060/blog/510166

Robot Framework: log messages sent through log4j's ConsoleAppender are not visible in output

北慕城南 提交于 2019-12-09 23:46:06
问题 I use Robot Framework with custom keywords implemented in java libraries. Messages written directly to System.out from my java classes are visible in the robot output - as promised in documentation. However, since the keyword implementations are reusable components, independent from robot framework, I wanted to have more flexible logging there and not using System.out directly. I thought if I redirect my log output to System.out (with log4j's ConsoleAppender), the messages will be visible in

How can I implement Robot Framework-style variables in this nestable For Loop?

帅比萌擦擦* 提交于 2019-12-09 18:47:43
问题 I've seen a lot of "nestable" For loops in Robot Framework, mostly creating a keyword with a For loop inside, then calling that keyword within another For Loop. I made a nestable For Loop using Python 2.7.13, but because it primarily uses Run Keywords syntax I couldn't create a variable using Robot Framework-style syntax (e.g. ${variable_name}= My Keyword ). For the record, this is Run Keywords under the BuiltIn Robot Framework library, which uses the following syntax: Run Keywords Keyword1

Is there a way to get Robot Framework to run test suites in a certain order?

为君一笑 提交于 2019-12-09 08:46:29
问题 Suppose I have 2 test suites in the local directory, foo and bar, and I want to run the test suite in the order of foo then bar. I tried to run pybot -s foo -s bar . , but then it just goes and run bar then foo (i.e. in alphabetical order). Is there a way to get pybot to run robot framework suites to be execute in the order that I define? 回答1: Robot framework can use argument files that can be used to specify order of execution (docs): This is from older docs (not online anymore): Another

Return results in Robot Framework keyword?

∥☆過路亽.° 提交于 2019-12-09 08:06:02
问题 How can I return the results after running a keyword? Example: mykey word [Arguments] input ${results}= getme input But I want to use these results: ${results} = mykey word newinput 回答1: The Robot Framework user's guide describes how to return a value from a keyword. See User keyword return values . The short version is: set a variable in your keyword, and use the [return] testcase setting to return that variable. Example, using the pipe-separated plain text format: *** Keywords *** | mykey

How to Execute python scripts in robot framework

别等时光非礼了梦想. 提交于 2019-12-09 07:16:19
问题 We have already automated scenarios using python scripts( .py ). We would like to execute these scripts in Robot Framework. Is there any option to execute Python script in RF. Could any one please suggest me here. 回答1: You can use the run_process keyword from the process library. It returns an object that has the status code, stdout and stderr. For example, this runs the script /tmp/helloworld.py: # example.robot *** Settings *** | Library | Process *** Test Cases *** | Example of running a

Browser never opens when running Robot Framework tests from Jenkins

牧云@^-^@ 提交于 2019-12-09 07:06:39
问题 I'm experimenting with running my RF/Selenium2Library tests from Jenkins on my OSX laptop. Jenkins is installed as default as user 'jenkins'. I have the RF plugin for Jenkins installed and environment variables set, and everything works fine EXCEPT the browser never opens (neither firefox nor chrome) and the tests fail with selenium timeouts saying that such and such element never appeared. My hunch is that I need to set a display variable somewhere to get the browser to open properly. Here's

Unable to scroll down the web page using the Robot Framework

痞子三分冷 提交于 2019-12-09 07:01:44
问题 I am using Selenium 2 and Robot Framework to automate our application. I have used the below JavaScript code to scroll down the page but am not able to scroll. I want to enter text inside the text box after scrolling down, but I am receiving the exception: Element not visible The text box is partially visible on the screen by default, if we manually scroll down than its completely visible, But selenium robot framework unable to scroll down. I have tried: Execute JavaScript window.scrollTo(0

For loop over dictionary in Robot Framework

柔情痞子 提交于 2019-12-09 06:07:58
问题 Is there a proper way to loop over a dictionary in RF? I used pythonic way, but failed: :FOR ${key} ${value} IN &{dict} output: Number of FOR loop values should be multiple of its variables. Got 2 variables but 1 value. Same, when i pointed dictionary as scalar variable. I couldn't find an example in documentation though. Has anyone solved that? P.S. I am aware of workaround solution, that you use kw. Get Dictionary Keys and Get Dictionary Values, then, to update values you use Set To

robot framework: Reuse existing Browser Window between Tests

心不动则不痛 提交于 2019-12-09 01:41:53
问题 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