Testing sqlite database howto ?

287 views
Skip to first unread message

Stewart Lees

unread,
Oct 30, 2013, 11:33:18 AM10/30/13
to robotframe...@googlegroups.com
Hello,

This is my first attempt at using robotframework, I have followed the demos and have selenium2Library working.

However i would like to test a sqlite database, the file is called cm.db 

----------------------------------

*** Settings ***
Documentation     frist db test attempt
...
...
Library           DatabaseLibrary

*** Variables ***
${DBAPI}          sqlite3
${DBNAME}         cm.db

*** Test Cases ***
Test1
    Con DB
    Check If Not Exists In Database    "HTTP Access prt"

*** Keywords ***
Check If Not Exists In Database
    [Arguments] ${value}
    select value from CMConfiguration where description = ${value}

Con DB
    Connect To Database     ${DBNAME}    ${DBAPI}

---------------------------------------

Starting test: Db Tests.Resource.Test1
20131030 15:31:30.658 :  FAIL : NoSectionError: No section: 'default'
Ending test:   Db Tests.Resource.Test1

Any help appreciated.

Kevin O.

unread,
Oct 30, 2013, 1:45:16 PM10/30/13
to robotframe...@googlegroups.com
I think you have transposed the arguments to Connect To Database. dbapiModuleName is first.
Change to:
Connect To Database     ${DBAPI}    ${DBNAME}

Stewart Lees

unread,
Oct 31, 2013, 4:51:32 AM10/31/13
to robotframe...@googlegroups.com
Thanks for the reply I had tried that and a few permutations.

the final fix was to use the "Connect To Database Using Custom Params" method

like so:
           Connect To Database Using Custom Params    sqlite3    database='cm.db'
Reply all
Reply to author
Forward
0 new messages