Photo by Kari Shea on Unsplash

Test Automation 101: (1) Workspace Setup Guide — Simple and Easy

Vince Reyes Tech

--

*This guide assumes a fresh installation and setup of everything on a Windows PC.

Part 1: Install the following prerequisite software

  1. Python 3.12.1
  2. Visual Studio Code
  3. Libraries: robotframework-seleniumlibrary
  4. Docker Desktop

(1) Python 3.12.1

Python Release Python 3.12.1 | Python.org

Download the recommended Windows executable installer.

Launch the installer. Make sure to check “Add Python 3.12.1 to PATH” and then click “Customize installation.”

Leave the default as it is and click “Next.”

Check “Install for all users.” The install location should be C:\Program Files\Python312. Click “Install.”

Once done, click “Close.”

(2) Visual Studio Code

Download Visual Studio Code — Mac, Linux, Windows

Launch the installer. Click “Next” on all the screens; there is no need to change any default settings.

Wait for the installation to complete.

Create a folder on your machine. Ex. “C:\Projects\TestProject”

Launch Visual Studio Code and click “Open Folder…”

Select the folder you just created.

Click “Yes, I trust the authors.”

Great! Your Visual Studio Code is ready.

(3) Robot Framework Selenium Library in a Virtual Environment

Open Terminal in Visual Studio Code.

Make sure you are using Command Prompt. If the terminal shows PowerShell, click the dropdown and select Command Prompt.

Create a virtual environment by entering the following commands:

python -m venv .venv
.venv\Scripts\activate.bat

You can confirm that the virtual environment is activated if you see “(.venv).”

Next, install the library:

pip install - upgrade robotframework-seleniumlibrary

That command would already install the other required robot framework libraries.

(4) Docker Desktop

Docker Desktop: The #1 Containerization Tool for Developers | Docker

Launch the installer, then wait for it to complete.

Once installation is complete, close the installer. We will use Docker Desktop in Part 2.

Part 2: Test Application Setup

We’ll be using a dedicated test application for this tutorial series called Puppy Bank. Public sites can change, which might break your scripts. So, we’ll set up your test application locally to avoid issues.

Want to know more about the test application? Read here:

Step 1

Launch Docker Desktop. Wait until the Docker Engine has started.

Step 2

Open the command prompt and run this command:

docker run -d -p 8000:8000 vncrtech/puppybank

Step 3

Go back to Docker Desktop. Notice that the command we executed created a container and is running.

Click the link under “Port(s)” to open the web application.

You should see the Welcome Page of Puppy Bank.

*Note: Next time you want to bring up the web application, you can go to Docker Desktop directly and start the container. There is no need to rerun the docker command.

Part 3: Workspace Setup

Step 1

Install Robot Code extension.

Step 2

Create a new robot file.

Step 3

Add the following block of code to your file:

*** Settings ***
Library SeleniumLibrary


*** Test Cases ***
Go to Puppy Bank
Open Browser http://localhost:8000
Close Browser

Step 4

Run the sample test.

Your workspace is ready if the browser launches and you see the Puppy Bank login page.

Congratulations! You may proceed to the next topic.

--

--