Sailesh Botcha
Sailesh Botcha

Reputation: 185

How can we run Robot framework scripts in remote windows server without internet

In My Company I have been asked to configure and make the Robot framework scripts to Run remote windows server which has only intranet but no internet.

I need Information regarding setting the configuration and installing all required libraries and tools, SSH and DB configurations to run my robot framework test cases .

It would be very helpful If i can get some information regarding this as i could not find any helpful reference regarding the same.

Upvotes: 0

Views: 3123

Answers (3)

Karl
Karl

Reputation: 11

1) First Ensure you have same version of Python installed on both PC's with env variables.

PYTHONPATH

C:\Python27\;C:\Python27\Scripts;C:\Python27\Lib\site-packages

PATH

allExistingPathVariables;%PYTHONPATH%;

2) Check that you have a newer version of pip installed if you are using Python 2. Python 3 seams to have everything already. Personally I use:

python -m pip install --upgrade pip-19.1.1-py2.py3-none-any.whl

3) Open a cmd prompt

NB If your company is anything like mine you will need to set your proxy each time you open a command prompt as per step 4 and 5. NOTE CMD prompt does not use the proxy already set in your browser.

4) set http_proxy=http://UserName:[email protected]:8080 -- t number is your username and whatever your current windows password it.

5) set https_proxy=https:// UserName:Password @proxy.nameOrIP.com.au:8080

6) cd C:\Python27\compiledLibraries ----This can be any folder you want…..

7) run lib_download.bat to download and update all the libraries and any internal dependancies they have from PyPi.org

8) Copy the whole downloadedLibrariesWithDependencies folder with new/updated libraries to Offline PC.

9) Open a cmd prompt on the Offline pc.

10) cd C:\Python27\compiledLibraries ----This can be any folder you want…..

11) run lib_install.bat file

Then all the libraries you keep adding to lib_ files get updated.

Contents of the .bat files should be something like:

lib_download.bat

REM This File contains list of all Libraries that are required for Exec Robot Tests 
REM Please Update your library with pip install command
mkdir downloadedLibrariesWithDependencies
cd downloadedLibrariesWithDependencies 
mkdir robotframework
pip download robotframework -d "robotframework"
mkdir python-dateutil
pip download python-dateutil -d "python-dateutil"
mkdir wheel
pip download wheel -d "wheel"
mkdir pylint
pip download pylint -d "pylint"
mkdir pytest
pip download pylint -d "pytest"
mkdir pywin32
pip download pywin32 -d "pywin32"
mkdir autopep8
pip download autopep8 -d "autopep8"

lib_install.bat

REM This File contains list of all Libraries that are required for Exec Robot Tests 
REM Please Update your library with pip install command
cd downloadedLibrariesWithDependencies 
cd ..\robotframework
pip install --upgrade robotframework -f ./ --no-index
cd ..\python-dateutil
pip install --upgrade python-dateutil -f ./ --no-index
cd ..\wheel
pip install --upgrade wheel -f ./ --no-index
cd ..\pylint
pip install --upgrade pylint -f ./ --no-index
cd ..\pytest
pip install --upgrade pytest -f ./ --no-index
cd ..\pywin32
pip install --upgrade pywin32 -f ./ --no-index
cd ..\autopep8
pip install --upgrade autopep8 -f ./ --no-index

Upvotes: 0

Temizzi
Temizzi

Reputation: 412

The simplest way is to DOWNLOAD SOURCE files from the internet first, then copy these files into your intranet network. I'm also running ROBOT Framework in my intranet network in my VM.

Follow these links:

  1. https://github.com/robotframework/robotframework/blob/master/INSTALL.rst#installing-from-source

  2. https://pypi.org/project/robotframework/

By the way, you need to install python first & set the python path in your environment variables. The stable python version for ROBOT Framework is Python 2.7, as for ROBOT Framework just use the latest version.

Upvotes: 0

Todor Minakov
Todor Minakov

Reputation: 20057

Disclaimer - haven't actually done it, so it might fail (or - might work :)

On a machine having internet access, install the same version of python and pip you are going to use on the target machine.

Create a virtual environment, & activate it:

c:\python3\python.exe -m venv robot-venv
robot-venv\scripts\activate

Install all packages you are going to need - I don't know what you're using, but robotframework and robotframework-seleniumlibrary are safe bets:

pip install robotframework
pip install robotframework-seleniumlibrary
# etc, the rest you'll be using

Create a requirements file of what you have installed - this is the crucial step, generating the list of all libraries you'll be using:

pip freeze > requirements.txt

The file will have the packages you've just installed, with their versions; for example:

robotframework==3.1
robotframework-seleniumlibrary==3.2.0
# and the others you installed

So now you need to download these, for transferring to the "offline" machine; the command is:

pip download -r requirements.txt

And now you have the packages as tar.gz files; take them, plus the requirements.txt, and transfer to the target machine (the one with only intranet access).


Create & activate a virtual environment there (the same commands as before). Once done, install the packages from the local copies:

pip install --no-index --find-links C:/the_dir_with_the_files/ -r requirements.txt

It is crucial the python and pip on the two machines to be the same version.

Upvotes: 1

Related Questions