Robot framework Learning 1-Test Data syntax

Source: Internet
Author: User
Tags types of tables

The robot framework uses the file extension to select which parser to use. The extension is case-insensitive. recognizable extensions include:

  • HTML:.html,.htmAnd.xhtml
  • TSV:.tsv
  • Plain text:.txtAnd special.robot
  • Restructuredtext:.rstAnd.rest

The plain text format is very easy to edit using the text editor and runs well in the version control system. Thanks to these advantages, the plain text format is the most common data format in the robot framework.

Space-separated format

When spaces are used for separation, the number of spaces is not fixed. At least two spaces are required. You can try to align the data to a better aspect. when using a text editor, this is a major advantage over the TSV format, because the TSV alignment cannot be controlled.

Because spaces are used as separators, all empty cells must be escaped. spaces can be used.${EMPTY}Variable, you can also use a backslash (\). The processing of spaces in other test data is no different. Escape the escape characters (including leading or trailing spaces and consecutive spaces.

TIPS:

We recommend that you use four spaces to separate keywords from parameters.

How to separate vertical bars with spaces

The biggest problem with space separation is that it is sometimes difficult to visually separate keywords and parameters. in particular, keywords contain spaces and many parameters. parameters may also contain spaces. in this case, it is better to use a vertical line and a space to define the demarcation line, so that the cell boundary is visually clearer and easier to distinguish.

Test data in a plain text file can be either a space separator or a space + vertical bar separator, but only one of them can be used within one line. a Data row with a vertical line and a space. It starts with the first vertical line of a required row, and the last vertical line of the row can be unavailable. there must be at least one space before and after the vertical line (except for the first and last lines). The vertical line does not need to be aligned, but alignment makes the data clearer.

After a vertical line is used, you do not need to escape empty cells (except for the end of the line). The only thing you need to note is that the leading and trailing vertical lines with spaces in the test data must be escaped using backslashes.

 

Test data table

There are four types of test data by structure, as listed in the following table. These test data tables are marked by the first cell in the table. The names of the four tables areSettings,Variables,Test Cases, AndKeywords. The matching is case-insensitive, and the singular form is as follows:SettingAndTest CaseAcceptable.

The test data is divided into multiple rows.

If the data is too large to be placed in one row, you can create another row. The ellipsis (...) To continue. in the test case and keyword table, there must be at least one empty cell before the ellipsis (because the first column only contains the use case name ). in settings and variable tables, you can directly put them under settings or variable names. in all types of tables, the empty cells before the ellipsis are ignored.

 

Robot framework Learning 1-Test Data syntax

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.