Understanding of the robot framework

Source: Internet
Author: User

Robot framework is an extensible keyword-driven automated testing framework developed based on python. It is usually used for end-to-end acceptance testing. It encapsulates the definitions of test cases, keywords, and test data into HTML or TSV (tab-separated) files. The user manual and the following: http://code.google.com/p/robotframework/


Some basic concepts of the robot framework:

  • Some column variables defined in the syntax $ {scalar}, @ {list}, $ {true/false}, and $ {null/NONE, both test data and test case keyword parameters are flexible.
  • The organizational structure of a test case is a case file that can contain a test suite. A set can contain multiple test cases. You can also use a case file to reference multiple other test case files.
  • Implement the specific behavior of keywords in a scalable and freely imported Test Library. Official Standard Test libraries include telnet, dialogs, remote, and screenshot. Extensions include seleniumlibrary and swinglibrary.

The format of the HTML use case file is shown in:



The purpose of this article is not to teach the use of RF, but to discuss and think about its design ideas. There is no doubt that RF is a comprehensive testing platform framework. Its keyword-driven technology is suitable for the mainstream ideas of TDD and BDD today. Let people describe test case in the format of natural language, and then the keywords in it will be converted into behavior (that is, function call ), for example, the standard key font operatingsystem contains the following keywords: Start
Process, wait until created, remove files, file shocould exist ...... These keywords can be directly used in the step description of test case, which is similar to what people usually talk. However, at the bottom layer of RF, spaces between them are replaced with underscores, and all letters are lowercase, it becomes the names of functions implemented by python in start_process and file_should_exist.


Next, PASS Parameters to the python function in combination with the variable format mentioned earlier, and execute the test case procedure. At the same time, in terms of variable management, RF will also come up with a separate table for Management (that is, the variable table in the figure ). This table not only contains the grouping and Design of test data, but also the necessary parameter configuration when the keyword corresponds to the function. It is a solution for separating test data from test scripts. Both use cases, data, and keywords are formatted as HTML tables, except that test data and test keywords are identified based on the table header, which are test cases, or even pre-configuration of the test (setting table ). In the demo of quickstart, they are all written in an HTML file. But to implement them, they must be written separately and managed separately. During running, different execution parameters are used to specify different paths (such as-V
-- Variablefile path) or introduce resource in the setting table.


Frankly speaking, I have also designed a similar key word conversion function to achieve automation, but it is not good at separating test data. The reason for hesitation and Tangle is that the implementation of the author uses Java, but I personally think that Java is a strong-type language, and the injection of test data into Java function calls has very strict parameter requirements, furthermore, the performance of Java invoke Method Using Reflection technology is not flattering. After understanding RF, although python is also a strong language, reflection and introspection mechanisms seem very convenient. From the perspective of the running effect of RF, in terms of test data and script separation, I think it is worrying or lazy!


Finally, let's talk about the report generated by RF. To be honest, it's really ugly. The colors are particularly bright and dazzling. However, I have to admit that the design and relevance of the report content are well designed. Layers are organized from test suite to test case to execution log of each case. This set of templates and ideas can be learned by the author to achieve a more user-friendly and more elegant and concise report.

PS: I hope my pro will get it earlier, and then I plan to reconstruct my automated testing platform framework based on RF understanding and receipt! -:) Add a new framework idea diagram first!








Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.