Database testing using Robot Framework
MySQL installer download link- [Link]
How to install- [Link]
Robot Framework Database Library provides many useful keywords to test database. To use robot
framework database library, you need to download the file "[Link]" if your
computer is 64 bit and install it.
For connections (MySQL) - pip install pymssql
Robot Framework Library- DatabaseLibrary (pip install robotframework-databaselibrary)
[Link]
Similarly ${DBpass}, ${DBport} and ${DBname} variables are created
Connection to database
Keywords
1. Check if exists in database
2. Row Count is less than X
Connect to Database pymysql ${DBname} ${DBuser} ${DBpass} ${DBhost} ${DBport}
Row Count is Less than X SELECT course_id from section 20
3. Selecting the entire table-returns a list
Using optional sansTran to run command without an explicit transaction commit or rollback:
@{queryResults} Query SELECT * FROM True
person
4. Using elements of list returned
@{queryresult} Query SELECT * FROM section;
Log Many @{queryresult}
Should Be Equal As Strings ${queryresult[0][0]} CSE-A
5. Execute query