How long does it take to set up your test automation development environment? How long does it take a new automation engineer on your team to set up their dev environment? Say you want to try out a new programming language, how much time do you spend figuring out what tools to use before you actually try out the language?
git clone
a projectIn this README, we will illustrate how to simplify the development experience using recent releases from Ubuntu, Intellij and Docker with the age-old X Window forwarding. This tutorial focuses on Windows as your base operating system.
This section outlines the prerequisite software you need installed on your local system to get this all running.
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
For additional details see...
VcXsrv looks like a good choice for an X Server on Windows. It is free, maintained, has good ratings, automatable, and easy to install via Chocolatey (you may choose this approach): choco install -y vcxsrv
.
That installed the most recent 64-bit version vcxsrv v1.20.1.4 released in Jan 2019 on my machine.
git clone https://github.com/oviney/test-automation-toolbox.git
test-automation-toolbox
directory and build the Docker image using /build.sh
or build.bat
startIntellij.bat
or startIntellij.sh
or run the powershell script. I typically open the powershell script and run it in the PowerShell IDE (default with Windows 10 Pro). One thing I noticed was I wanted to automate the manual steps to encourage me to use it. So, here are a few of my favourite hacks.
Note: When you choose to store IDE preferences and plugins in the Docker container, you run
docker run ...
the container only once, then after that you startdocker start ...
the container. Details on the difference below. If you don't do it this way, you'll lose your data.
$prog="$env:ProgramFiles\VcXsrv\vcxsrv.exe"
if (! (ps | ? {$_.path -eq $prog})) {& $prog -multiwindow -ac}
# get the IP address used by Docker for Windows
$ip = Get-NetIPAddress `
| where {$_.InterfaceAlias -eq 'vEthernet (DockerNAT)' -and $_.AddressFamily -eq 'IPv4'} `
| select -ExpandProperty IPAddress
echo $ip
# start
$cmd="intellij-idea-community"
set-variable -name DISPLAY -value ${ip}:0.0
echo $DISPLAY
docker run --rm `
-e DISPLAY=$DISPLAY `
--security-opt seccomp=unconfined `
--name toolbox-intellij `
oviney/test-automation-toolbox:latest
Start Docker container (data from previous sessions persisted), fire up Intellij, using local git repo (on laptop), using Docker image to store the IDE preferences and plugins.
C:\Users\ouray>docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
C:\Users\ouray>docker images REPOSITORY TAG IMAGE ID CREATED SIZE oviney/test-automation-toolbox latest fcffde991fb6 5 minutes ago 1.97GB oviney/ubuntu-vscode latest df830a104655 20 minutes ago 517MB