20190923- based configuration RobotFramework is the first use of Python3

Because of the recent change automation framework for the Internet to find a lot of framework, we found RobotFramework good, but the information online is very complex, now configure their own study notes shared framework

Python configuration RobotFramework of seleniumlibrary

Preconditions: Installed python3

Step 1: Install RobotFramework

cmd command input: Python -m PIP install robot framework

Step 2: Install seleniumlibrary

cmd command input: Py --upgrade robot framework -m-seleniumlibrary the install PIP

Step 3: Install Test_Case Editor

Python2 used RIDE editor does not support python3, python3 editor available include Atom , the Eclipse , Notepad ++ , IntelliJ IDEA , Sublime text , Vim can find the corresponding plug-in, where the use Notepad ++

Step1: Download the add-on package, download address https://github.com/vkosuri/npp-robot/archive/master.zip

Step2: Unzip

Step3: in NotePad ++ click inside the language -> Custom Language Format -> Import, select Import step2 decompress files lang-robot.xml

After installation is complete Notepad ++ is shown below:

RobotFramework of seleniumlibrary use

RobotFramework user manual

https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html

RobotFramework of seleniumlibrary keyword manual

It lists the keywords you can use

https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html

RobotFramework of seleniumlibrary test cases constitute

Test format is as follows:

————————————————————————————————————

*** Settings***

Configuration information, specify the libraries to 4 separate spaces

Library    seleniumLibrary

*** Variables ***

Variable definitions to 4 separated by spaces

${LOGIN URL}      http://www.baidu.com

${BROWSER}        Firefox

$ {SEARCH_TEXT}       studied hard robot frame

*** Test Cases ***

The name of the test case format: keywords, the parameters needed to operate a parameter required for the operation key 2 . . .

Key     operating values    Operating value    Operating value

*** Keywords ***

Keyword Name

The name of the test case format: keywords, the parameters needed to operate a parameter required for the operation key 2 . . .

Key     operating values    Operating value    Operating value

————————————————————————————————————

Configuration

The format is defined as follows:

————————————————————————————————————

*** Settings ***

Library    seleniumLibrary

————————————————————————————————————

Specifies the library of test case execution, is a py file, which defines the corresponding keyword method

variable

The format is defined as follows:

————————————————————————————————————

*** Variables***

${LOGIN URL}      http://www.baidu.com

${BROWSER}        Firefox

$ {SEARCH_TEXT}       studied hard robot frame

————————————————————————————————————

Format for the variable name, variable value

Test Case

The format is defined as follows:

————————————————————————————————————

*** Test Cases ***

Test case name

Key     operating values    Operating value    Operating value

————————————————————————————————————

Where the parameter keyword manipulation operations may be 0 , which are also likely to be more than, the preferred time to call to find Keywords whether the module has a corresponding keyword, and if not, then at seleniumLibrary looking inside

Keyword

The format is defined as follows:

————————————————————————————————————

*** Keywords ***

Keyword Name

Key     operating values    Operating value    Operating value

————————————————————————————————————

In the test case which defines the specific run sequence after the keyword:

1.     First, go to keywords keywords inside to find the corresponding

2.     If the keywords there are corresponding keywords, call the corresponding keyword (from seleniumLibrary library provided)

 

3.     If the keywords which do not correspond to keywords directly call the corresponding keyword (from seleniumLibrary library provided)

Based seleniumlibrary examples

File write test cases as follows:

 

 

 

 The file .robot suffix save

 

In the case of the file should be saved after entering the directory cmd mode, execute python -m robot testbaidu.robot

 

 View the results

 

 

 View report.html file

 

 Click on the appropriate test set

 

 

 Click on the appropriate testcase

 

 

 To verify that the page is displayed as "He strenuously learning robot frame" Authentication failed, failed shots are as follows

 

Guess you like

Origin www.cnblogs.com/hyj691001/p/11572437.html