错误:无部分:Robot Framework 中使用 DatabaseLibrary 的“默认" [英] Error: No section: 'default' in Robot Framework using DatabaseLibrary
问题描述
我正在使用带有数据库库的机器人框架来测试本地主机上的数据库查询.我由 XAMPP 运行它.
这是我的测试用例:
我已经为 Python 2.7 安装了 MySQLDb,但是,当我使用 pybot 运行它时,它不断返回错误:
从数据库中选择 |失败 |
NoSectionError:无节:默认"
请帮我解决这个问题.谢谢.
您应该检查 dbConfigFile 的内容.您没有指定一个,所以默认的一个是 ./resources/db.cfg.
错误表示当 python 尝试解析该文件时,它找不到名为 default 的部分.在文档中它说:
<块引用>注意:直接指定dbapiModuleName、dbName、dbUsername或dbPassword会覆盖dbConfigFile中相同key的属性
因此,即使您指定所有属性,它也会读取配置文件.
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.
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.
这篇关于错误:无部分:Robot Framework 中使用 DatabaseLibrary 的“默认"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!