Error: No section: 'default' in Robot Framework using DatabaseLibrary

妖精的绣舞 提交于 2021-02-08 08:32:28

问题


I am using Robot Framework with Database Library to test database queries on localhost. I am running it by XAMPP.
This is my test case:

*** Settings ***
Library           DatabaseLibrary

*** Variables ***
@{DB}             robotframework    root    \    localhost    3306

*** Test Cases ***
Select from database
    [Tags]    This
    Connect To Database    MySQLdb    @{DB}[0]    @{DB}[1]    @{DB}[2]    @{DB}[3]    @{DB}[4]
    @{results}=    Query    Select * From tbName
    Log Many    @{results}

I have installed MySQLDb for Python 2.7, however, when I run it using pybot, it keeps returning error:
Select from database | FAIL |
NoSectionError: No section: 'default'
Please help me to solve this problem. Thanks.


回答1:


You should check the content of dbConfigFile. You don't specify one so the default one is ./resources/db.cfg.

The error says when python try to parse that file it cannot find a section named default. In documentation it says:

note: specifying dbapiModuleName, dbName dbUsername or dbPassword directly will override the properties of the same key in dbConfigFile

so even if you specify all properties it reads config file.



来源:https://stackoverflow.com/questions/25072996/error-no-section-default-in-robot-framework-using-databaselibrary

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