Design of interface test framework based on Python connection database
The first is to connect the database operations, preferably written in a single module,
Then convenient to call, based on the connection connection in the __init__ () method
The delete SELECT INSERT upddate is then defined separately.
Call the DB directly in the other file. DELETE (table_name) to use this method
The code is as follows:
The first is the primer package, here to note is to download the driver module: pymysql
Then the initialization part, in fact, is to put some configuration of the connection database here, do the connection
The next step is to write the Delete method,
The method is simple, just do not forget, execute a SQL, to connection commit!!!!
This is important, if the database is not committed
Next up is SELECT, Update, select, and you don't say a word.
Finally, it is recommended to remember the test data after completion!!!
So as not to cause trouble for others to test
You can debug it while you're writing. After all, it's important to use your own habits.
PYTHON-DB Module