Oracle database library for Robot Framework
Project description
OracleDBLibrary
OracleDBLibrary is a database testing library for Robot Framework that utilizes the cx_Oracle tool internally. The project is hosted on GitHub and downloads can be found from PyPI.
Installation
The recommended installation method is using pip
pip install --upgrade robotframework-oracledb-library
Usage
To use OracleDBLibrary in Robot Framework tests, the library needs to first be imported using the Library
setting as any other library.
When using Robot Framework, it is generally recommended writing as easy-to-understand tests as possible.
The keywords provided by OracleDBLibrary is pretty low level, though, and often require implementation-specific arguments like data source name (DSN) to be passed as arguments.
It is thus typically a good idea to write tests using Robot Framework's higher-level keywords that utilize OracleDBLibrary keywords internally.
This is illustrated by the following example where OracleDBLibrary keywords like ORACLE MAKEDSN
, ORACLE CONNECT
, ORACLE CONNECTION PING
and ORACLE CONNECTION CLOSE
are primarily used by higher-level keywords like CONNECT TO ORACLE DATABASE WITH SID
.
*** Settings ***
Library OracleDBLibrary
*** Variables ***
${HOST} localhost
${PORT} 1521
${SID} ORCLCDB
${USER} SYS
${PASSWORD} Oradoc_db1
${MODE} SYSDBA
*** Test Cases ***
CONNECT TO ORACLE DATABASE AND INSERT DATA
CONNECT TO ORACLE DATABASE WITH SID
INSERT DATA INTO ORACLE DATABASE
DROP ORACLE DATABASE TABLE
CLOSE ORACLE DATABASE CONNECTION AND CURSOR
*** Keywords ***
CONNECT TO ORACLE DATABASE WITH SID
${DSN} ORACLE MAKEDSN host=${HOST} port=${PORT} sid=${SID}
ORACLE CONNECT user=${USER} password=${PASSWORD} dsn=${DSN} mode=${MODE}
${CONNECTION STATUS} ORACLE CONNECTION PING
SHOULD BE EQUAL ${CONNECTION STATUS} ${NONE}
INSERT DATA INTO ORACLE DATABASE
ORACLE CONNECTION CURSOR
${FIRST TABLE ROW} EVALUATE (1432, 'Ahmet', 'Yalcinkaya')
${SECOND TABLE ROW} EVALUATE (1453, 'Abdullah', 'Deliogullari')
${THIRD TABLE ROW} EVALUATE (1481, 'Erim', 'Cerrahoglu')
ORACLE CURSOR EXECUTE CREATE TABLE persons (person_id NUMBER GENERATED BY DEFAULT AS IDENTITY, first_name VARCHAR2(50) NOT NULL, last_name VARCHAR2(50) NOT NULL, PRIMARY KEY(person_id))
ORACLE CURSOR EXECUTE INSERT INTO persons (person_id, first_name, last_name) VALUES ${FIRST TABLE ROW}
ORACLE CURSOR EXECUTE INSERT INTO persons (person_id, first_name, last_name) VALUES ${SECOND TABLE ROW}
ORACLE CURSOR EXECUTE INSERT INTO persons (person_id, first_name, last_name) VALUES ${THIRD TABLE ROW}
ORACLE CONNECTION COMMIT
DROP ORACLE DATABASE TABLE
ORACLE CURSOR EXECUTE DROP TABLE persons
ORACLE CONNECTION COMMIT
CLOSE ORACLE DATABASE CONNECTION AND CURSOR
ORACLE CURSOR CLOSE
ORACLE CONNECTION CLOSE
License
Robot Framework is open source software provided under the Apache License 2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for robotframework-oracledb-library-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2027edf6cf9bbced57e1ec1bf15b78b9f844688301604a7ace4386b2b7e5157a |
|
MD5 | 90e3ff866ceb794ec707da5da6d62660 |
|
BLAKE2b-256 | 076a19732d25c8a55e7a02b8cc71765e9d4bfda7662f2851979bc8273c29b8a3 |
Hashes for robotframework_oracledb_library-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5c39c15ae638e35aa87230f5cb44023989c88b3465aaa6dfde20c80b6e26fe8 |
|
MD5 | be79b612a8f9e74eaf1cac7554faf74b |
|
BLAKE2b-256 | 20437311e4cd44a1545970421cc46c0cf15b6ce49bfa5bd6906a9fca54aeacda |