Interface platform HttpRunner learning_Hooks&debugtalk.py

Hooks

During UI testing, the preparation operation will be initialized before the execution of the UI automation use case, and the restore environment operation will be cleared after execution.
——For example, the setUp/tearDown methods in Katalon are used for users to perform initial configuration during testing or clear configuration
after execution. Special processing before and after execution of interface test cases, such as initialization operations before execution, and waiting operations after execution . The Hook function in HttpRunner also supports such operations.
——Setup_hooks: execute the hook function before the HTTP request is sent, mainly used for preparation; also can realize the preprocessing of the request content of the request——
teardown_hooks: execute the hook function after the HTTP request is sent, mainly used for cleaning up after the test Work; it can also modify the response of the response, such as encryption and decryption
Insert picture description here

debugtalk.py

Location: in project management-debugtalk.py
Role: used (python language) to define related functions and variables, such as some common public methods: operating database (executing SQL statements), reading files, encrypting and decrypting, obtaining random numbers, etc.
Insert picture description here
Usage: call a function in debugtalk.py, which is: ${function name ($parameter)}
Example: the function defined in debugtalk.py is get_name(n), then it is ${get_name(1) when quoted }

Guess you like

Origin blog.csdn.net/weixin_43533308/article/details/105229402