Windows application Test Automation (Part 1)
Time ago, automating tests on Windows Application testing has been either very difficult or extremely expensive. As the test automation industry gets gradually evolved, this burden gets slowly disappear. So, now it’s much easier to test Windows applications.
This is the first article of a series of three, in this article, I’m planning to cover the preparation of the Windows environment to perform automated tests.
Few things to note before we start;
- All these configurations are limited to Windows 10 OS versions only and is only a one-time setup.
- There are different configuration flows available which you could test windows, Here I’m only covering one way only. I will explain the rest in subsequent articles.
- I have provided the descriptive steps and verifications after the installation of each software. Please check your verification compare with the given example, before you move into the next step of the configuration.
So, Let’s jump right into it !!!
Configuring Windows10 for Test Automation
1. Install Java version 8+ and set Java path
Verify your Java properly set up;
Type ‘javac -version’ in the Windows Command Line Console or PowerShell
javac -version
if Java is successfully configured, it should like the below screenshot. Else your path is incorrect, or java is not properly downloaded please check.
2. Install NodeJS (Node)
After installing Java, you would require to Node install in your PC. (Why it’s a dependency for Appium server to run)
Check whether Node is already installed on your Windows PC;
If Node is not present, download and install, else update to the latest stable version
- To Check whether Node is installed on your PC, type ‘node -v’ in the Windows Command Line Console.
node -v
If you are getting like the above message, Node is not installed (most likely). Installed it.
- Download Node and install latest the stable version from: https://nodejs.org/en/download/
2. Set Node environment variable, ensure ‘Add to PATH’ option is selected during the installation as per below; or else manually set path;
Update Node if Node already exists on your PC, please update to the latest (as above);
- Download Node and install latest the stable version from: https://nodejs.org/en/download/
- Set Node environment variable, ensure ‘Add to PATH’ option is selected during the installation as per below; or else manually set path;
Verify Node installation;
Type ‘node -v’ in the Windows Command Line Console.
node -v
3. Update Node package manager
After installation of Node, you need to update the Node package manager
Type ‘npm install -g npm@next’ in the Windows Command Line;
npm install -g npm@next
4. Install Appium server (Not the Appium Desktop Server GUI)
**Please do not get confused with Appium Desktop server GUI, we will be using it in a later part, but not now.
Appium Server installation is one of the key important installations, therefore it’s utterly important to get this right.
- Open Windows Command Line Console using Administrator mode.
2. Execute ‘npm install -g appium@latest’ in Windows Command Line Console;
npm install -g appium@latest
3. Once Appium installation completed, verify Appium installation by executing below;
appium -v
Your result should look like the above;
6.Test Run of Appium
Appium is a significant component of Windows Test Automation, therefore it’s important to check we have been setting up is working in order.
Execute following command in Windows Command Line Console;
appium &
It should look like this;
If you are getting this, You have successfully installed Appium. If you don’t, please go to the beginning of the configuration and check where you have missed. The verifications are provided on each step.
7. Download and install Winappdriver 1.2.1
Click the here to download WinAppDriver 1.2.1
If unable to download, navigate to following Github page and download’’ WindowsApplicationDriver_1.2.1msi ;(https://github.com/microsoft/WinAppDriver/releases)
Verification on WindowsApplicationDriver installed properly;
Note: during the installation if you installed in a customized location , keep a track of the file location, since we will need it on a later part of the configuration
- Go to Windows ‘Programs and Features’ and filter ‘Windows Application Driver’ , and ensure WinAppDriver is present and it’s version;
8.Switch on window developer mode of the windows
Open Windows Settings > Update and Security > For Developers
Switch on ‘Developer Mode’
9. Configuration for Remote accessing (Optional)
This configuration is not essential, it will only be used for the ones who need to execute tests in a remote PC while the codebase or test scripts are located in another PC.
So, If you do not have any plans for remote execution yet, it’s totally okay to skip this part. Later if change your mind you could come back change it.
This configuration is for enabling Windows firewall to accept traffic (test commands) from the remote PC where test scripts are located to the Application Under Test (AUT) machine, therefore this configuration should be done in the test execution PC.
Open Windows Command Line Console in Administrator mode;
netsh advfirewall firewall add rule name=”WinAppDriver remote” dir=in action=allow protocol=TCP localport=4723
In the above command, take a note of the following parameters;
- name — > “WindappDriver remote” -(optional) -Rule name
- localport — > 4723 - (WinAppDriver standard) -local port number
We have completed the pre-configuration of running automated tests on the Windows environment. This will be the first article of series of three.
In the next article, I discuss setting up the execution environment. Refer following link: Windows application Test Automation (Part 2)