Python + Robotframework realizes interface automation testing (Part 1)

Share today:

When using robotframework-ride combined with python, some difficulties encountered in the process of performing interface automation testing are explained.

1. The jsxcompressor.min.js file is required in the C:\Python27\lib\site-packages\robot\htmldata\lib\jsxcompressor.min.js directory, which can avoid this error when executing the test case: [ ERROR ]

Writing
report file 'c:\users\190146\appdata\local\temp\RIDEcbrrku.d\report.html' failed: No such file or directory: C:\Python27\lib\site-packages\robot\htmldata\lib\jsxcompressor. min.js

2. Rebot report Sinicization method

1. You need to have a [rebot report Sinicization.zip] installation package

2. After decompressing rebot, put the view.js & report.html file in X:\Python27\Lib\site-

Three lines of code need to be added at the beginning of the following files under packages\robot\htmldata\rebot :

1). C:\Python27\Lib\site-packages\robot\htmldata\htmlfilewriter

2). C:\Python27\Lib\site-packages\

The codes added by logreportwriters, outputwriter and resultwriter under the robot\reporting file are:

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

 3. Points to note when adding code

: logreportwriters.py file and C:\Python27\Lib\site-packages\robot\htmldata\htmlfilewriter.py file under C:\Python27\Lib\site-packages\robot\reporting file, To put the following figure:

The import information in the red box must be placed on the first line, otherwise an error will be reported and the log will not be printed when the test case is executed

3. Click in testSuit: Library and enter the value of the attribute name in the pop-up box: Logistics

Logistics has been customized in the directory: C:\Python27\Lib\site-packages, as shown in the following figure:

There are .py files that need to be run in the Logistics directory, as shown in the following figure:

1. The custom directory name is consistent with the class name in the __init__.py file;

2. When there are multiple .py files in the customized directory, pay attention when editing __init__.py, as shown below:

3. "class SensitiveWords (Add, Check, delete, Filter, getCount, searchWord):" in the __init__.py file indicates that this class inherits the imported class, and the class name in brackets is the imported class name;

Finally:  The complete software testing video learning tutorial below has been sorted out and uploaded, and friends can get it for free if they need it【保证100%免费】

insert image description here

 These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey. I hope it can help you too!

Guess you like

Origin blog.csdn.net/wx17343624830/article/details/130485678