Database testing using Robot Framework
MySQL installer download link- https://dev.mysql.com/downloads/installer/
How to install- https://www.youtube.com/watch?v=iHTI_Nk7uwo
Robot Framework Database Library provides many useful keywords to test database. To use robot
framework database library, you need to download the file "pymssql-2.1.0.win-amd64-py2.7.exe" if your
computer is 64 bit and install it.
For connections (MySQL) - pip install pymssql
Robot Framework Library- DatabaseLibrary (pip install robotframework-databaselibrary)
https://franz-see.github.io/Robotframework-Database-Library/
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