I was trying to connect to the SQL Server 2012 database using the robot framework for a long time unsuccessfully, finally came up with this
*** Settings ***
Test Setup Connect To Database Using Custom Params
pymssql ${server},${username},${password},${databasename},${trusted}
all in a single line with tab spaces inbetween
Where Test Setup - Is the key word used under Settings for setting up the DB Environment in this case Connect To Database Using Custom Params -- are the keywords to connect to database which are found in the databaselibrary of RobotFramework pymssql - Module for connecting with SQLSERVER database
The below are the parameters to be passed
- server - name of the server in single quote
- username - Username along with the domain name - format - 'domain-name\username'
- Password - self explanatory
- Trusted - The value should be set as 'True'
This helped me in establishing the connection with sql server 2012, but i still face issues.
Error message Setup failed: SyntaxError: EOL while scanning string literal (, line 1)
In Robotframework if you want to work with SQL Server. Down load pyodbc package. Add Library to the testcase. Then write query to execute. Below is the sample code
*** Settings *** Library DatabaseLibrary Library OperatingSystem Library pyodbc