14. Visual Testing

14.1. Introduction

To achieve effective visual testing in a highly automated way you need to have created highly varied tests. Vitaq can auto-generate highly varied tests 24/7 once you have defined your Test Activity for User Interface testing. There are many open source python libraries for image recognition as well as AI based approaches. There are also commercial tools and one which we think is worth a reference here is Applitools https://applitools.com/ a very powerful AI based image recognition test automation tool.

14.3. Applitools with Vitaq powered by Scriptworks

Vitaq AI powered by Scriptworks visual testing scripts (https://vimeo.com/336576333) can readily interface with Applitools.

14.4. Applitools with Vitaq and Python test Action Scripts

To use Python Scripts we first need to install and import the applitools.eyes python package.

First we need to ‘pip’ the package

C:\Python27\scripts> pip install applitool.eyes

then include these line in the imports Test Action Script

import applitools.eyes from applitools.eyes import Eyes

Add all the following lines pf code into your Activity Start Test Action Script. First we ‘instance’ Eyes and then call your api_key

self.eyes = Eyes() self.eyes.api_key = 'Put_Your_AppliTools_Key_HERE'

Then we can start Applitools eyes and set the viewport size for visual checking

self.eyes.open(driver=self.driver, app_name='My_web_APP', test_name='Vitaq Test Activity') viewport_size = {'width' : 1000, 'height' : 780} self.eyes.set_viewport_size(self.driver, viewport_size)

Then we call the applitools eyes driver to substitute the driver called in the Test Interface File

self.eyes.get_driver() self.test_if.create_interface('SUT', TestInterface, driver=self.driver)

Then you simply call applitools eyes check_window to compare your apps visual render against a baseline that you have stored in applitools

# Visual checkpoint of balance result self.parent.eyes.check_window('Balance_For_{}'.format(self.parent.New_Account_Name))

_images/20_Applitools.png