Licensed under the MIT License. See file LICENSE.
Robot Framework FTP and database example. Example includes code written in Robot Framework and Python.
Installation
pip install robotframework
pip install robotframework-ftplibrary
pip install robotframework-databaselibrary
Or use existing requirements.txt
. Check installation with robot --version
.
Start servers with docker compose up -d
.
Run test with robot --outputdir ./log ./upload_tests/upload_e2e.robot
The Docker files and test files assume that a .env
file exists with the following content.
PUBLICHOST=<ftp server name>
FTP_PORT=<ftp server port>
FTP_USER_NAME=<ftp user name>
FTP_USER_PASS=<ftp user password>
FTP_USER_HOME=<ftp user home path>
POSTGRES_DB=<postgresql database name>
POSTGRES_USER=<postgresql user name>
POSTGRES_PASSWORD=<postgresql user password>
PGHOST=<db server name>
PGPORT=<db server port>
PGDATABASE=<postgresql database name>
PGUSER=<postgresql user name>
PGPASSWORD=<postgresql user password>
Create virtual environment with python -m venv .venv
.
Activate environment, for example with .venv\Scripts\activate.bat
on Windows and list packages with pip list
.
Restore environment with pip install -r requirements.txt
.
Save environment after adding packages with pip freeze > requirements.txt
.
Initialize a database cluster in directory psqldb
with initdb -D psqldb
.
Start server with pg_ctl start -D psqldb -l log\psql.log
.
Create database with createdb robotdb
.
Create database schema with bin\createSchema.bat
.
Connect to database with psql robotdb
.
Quit the psql program with \q
or \quit
.
Stop server with pg_ctl stop -D psqldb -m smart
.
- Robot Framework
- Python
- ftplib — FTP protocol client
- Psycopg - PostgreSQL adapter for the Python programming language
- python-dotenv - reads key-value pairs from a .env file and can set them as environment variables
- PostgreSQL
- Replace hard coded insert in src/processor.py with ftp file content
- Create DB schema on DB container build