-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
test/tests/custom_db_tests/multiple_connections/multi_db_different.robot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
*** Settings *** | ||
Documentation Connections to two different databases can be handled separately | ||
Library DatabaseLibrary AS 1_PostgreSQL | ||
Library DatabaseLibrary AS 2_MySQL | ||
|
||
Suite Setup Connect To All Databases | ||
Suite Teardown Disconnect From All Database | ||
Test Setup Create Tables | ||
Test Teardown Drop Tables | ||
|
||
|
||
*** Variables *** | ||
${Table_1} Table_1 | ||
${Table_2} Table_2 | ||
|
||
|
||
*** Test Cases *** | ||
First Table Was Created In First Database Only | ||
1_PostgreSQL.Table Must Exist ${Table_1} | ||
Run Keyword And Expect Error Table '${Table_2}' does not exist in the db | ||
... 1_PostgreSQL.Table Must Exist ${Table_2} | ||
|
||
Second Table Was Created In Second Database Only | ||
2_MySQL.Table Must Exist ${Table_2} | ||
Run Keyword And Expect Error Table '${Table_1}' does not exist in the db | ||
... 2_MySQL.Table Must Exist ${Table_1} | ||
|
||
*** Keywords *** | ||
Connect To All Databases | ||
1_PostgreSQL.Connect To Database psycopg2 db db_user pass 127.0.0.1 5432 | ||
2_MySQL.Connect To Database pymysql db db_user pass 127.0.0.1 3306 | ||
|
||
Disconnect From All Database | ||
1_PostgreSQL.Disconnect From Database | ||
2_MySQL.Disconnect From Database | ||
|
||
Create Tables | ||
${sql_1}= Catenate | ||
... CREATE TABLE ${Table_1} | ||
... (id integer not null unique, FIRST_NAME varchar(20), LAST_NAME varchar(20)) | ||
${sql_2}= Catenate | ||
... CREATE TABLE ${Table_2} | ||
... (id integer not null unique, FIRST_NAME varchar(20), LAST_NAME varchar(20)) | ||
1_PostgreSQL.Execute Sql String ${sql_1} | ||
2_MySQL.Execute Sql String ${sql_2} | ||
|
||
Drop Tables | ||
1_PostgreSQL.Execute Sql String DROP TABLE ${Table_1} | ||
2_MySQL.Execute Sql String DROP TABLE ${Table_2} |