Huy Do
Huy Do

Reputation: 470

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

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.

Upvotes: 1

Views: 6371

Answers (1)

alpert
alpert

Reputation: 4655

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.

Upvotes: 3

Related Questions