How to use database library with Robot Framework on temporary sql server

给你一囗甜甜゛ 提交于 2021-02-20 04:00:35

问题


I am using Robot Framework's database library which supports database validation.

I tried to execute this basic command:

***Variables***
***Settings***
Suite Setup  
Suite Teardown  
Test Setup  
Test Teardown  
Library  DatabaseLibrary
***Testcases***
UC_DB_Validation

To connect to the Database I'm using:

dbapiModuleName=Mysqldb  dbName='bigetestsrv'  dbUsername='ravitest'  dbPassword='welcome'  dbHost='10.73.92.18'

When running the connection string from command prompt using pybot I get the following error:

"No Module Named as Mysqldb"

I am using Query Express with valid credentials and I do not have a Sql Server installed in my machine.

How can I connect to my DB?


回答1:


I got .....

I was approaching in a wrong way The Database Library (Apache License) from http://franz-see.github.com/Robotframework-Database-Library/ i am using is currently tested only with postgresql using psycopg2, it may or may not work with other RDBMS. So I tried it to connect pymssql db, which is supporting bydefualt and it worked.

I used Connect To Database Using Custom Params pymssql 'dbname', 'username', 'password', 'host'

As a prerequisite i need to install Pymssql (GNU Lesser General Public License) from http://pymssql.sourceforge.net/license.php

Thanks




回答2:


Instead of :

dbapiModuleName=Mysqldb

Use :

dbapiModuleName=PyMySQL

Also, Please make sure PyMySQL module is installed in your machine using pip command.



来源:https://stackoverflow.com/questions/10882503/how-to-use-database-library-with-robot-framework-on-temporary-sql-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!