问题
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