We can add a sql check_sql store need to query the database in Excel test document, and then we passed determine whether empty, not empty explained there is a need in the sql database queries, call the MySQL database package execute sql, from the results extract the data they need validation;
Case = check_sql [ ' check_sql ' ] # acquiring data from the test case check_sql IF check_sql: # determines whether the air # If not empty check_sql Parameterization check_sql = Context.recharge_parameterization (check_sql) # execute sql statement, return dictionary mysql_data self.do_mysql.get_value = (SQL = check_sql) # extracted data fields from the query results amount_before = a float (mysql_data [ ' LeaveAmount ' ])
Automation example with style:
- Single sql: a single store
- Multiple sql: We can use the dictionary to save key-value pairs
******* Please respect the original, as to reprint, please indicate the source: Reprinted from: https://www.cnblogs.com/shouhu/ Thank you! ! *******