Documentation - Getting started

Table of Contents

  1. What is Oculow
  2. Getting started
    1. Installing SDK
    2. Importing driver
    3. Configuring driver
      1. Setting your apikey
      2. Project identifier
      3. Baseline management
      4. Comparison Logic
    4. Simple ui test example
  3. How to use the Dashboard?

What is Oculow

Oculow is a visual testing tool, which gives the user the possibility to easily integrate image comparison and error detection to their ui test suite. For more detailed information visit our website. www.oculow.com

Getting started

Installing Oculow driver

In order to facilitate all communication with our servers and to facilitate capturing the apps screenshot, we provide a SDK. You can install the sdk in the following ways.

npm i oculow
pip install oculow

<dependency>
<groupId>com.oculow</groupId>
<artifactId>sdk</artifactId>
<version>0.0.5</version>
</dependency>
implementation 'com.oculow:sdk:0.0.5'
implementation("com.oculow:sdk:0.0.5")
libraryDependencies += "com.oculow" % "sdk" % "0.0.5"
<dependency org="com.oculow" name="sdk" rev="0.0.5" />
@Grapes(
    @Grab(group='com.oculow', module='sdk', version='0.0.5')
)
[com.oculow/sdk "0.0.5"]
'com.oculow:sdk:jar:0.0.5'

Importing driver

To make use of all of the functions provided by the SDK, it is needed to import this to the project. To do so, you need to replicate the following logic.

import oculow
import com.oculow.Oculow;
let oculow = new oculow.Oculow();

Configuring driver

We need to properly define all settings related to the driver, this way we can properly define all parameters that are going to be tested. For example, if we want to detect exact pixel differences between the 2 images(below are listed all possible comparison levels). Or if we get the most out of our test, and only detect errors to avoid all of the baseline maintenance hassle.

Setting your apikey

This will set the api_key obtained through our website. It is required for validation of the user and it is also used for binding the data to the appropriate user. If you want to learn more about how to generate an apikey, please reffer to this guide.
https://blog.oculow.com/2020/02/25/how-to-use-our-dashboard/

oculow.set_api_key(API_KEY)
oculow.setApiKey(API_KEY)
oculow.setKeys("API_KEY", "SECRET_KEY")

Project identifier

Sets the identified for your app, this will group up the executions to the corresponding app. This way, you can filter easily between project. We recommend you simply put the app name.

oculow.set_app_id("myFirstTest")
oculow.setAppId("myFirstTest")
oculow.setAppId("myFirstTest")

Baseline management

Defines the baseline management logic.
The baseline management system will define the action to be taken to the baseline of each image. There are 4 types of logic that can be used. Each one can be set by referencing the library and indicating the level.

For example:

oculow.set_baseline_management(oculow.ASSISTED)
oculow.setBaselineManagement(oculow.ASSISTED)
oculow.setBaselineManagement(oculow.ASSISTED)

The four options are:

oculow.MANUAL
oculow.ASSISTED
oculow.FORCE_NEW
oculow.FORCE_ALL

Click here for more details on each management logic

Manual management level

Each new image will cause the test to fail, indicating that there is a new baseline to be set. You will have to manually accept each baseline.

Assisted management level

We will apply our A.I. technologies to detect if any visual errores exist in the image. If none are detected, the image is set as baseline. Otherwise, a prompt will be sent to the test, causing it to fail and ask for manual input.

Force new management level

Any new baselines detected will be forced as baselines. Any existing images will be compared and if differences exist, it will fail the test.

Force all management level

All images will be forced as baselines. If the comparison fails, it will set the new image as a baseline. Can be useful when major app changes occur, in order to update all baselines.

Comparison Logic

Changes the logic use for the comparison stage. There can be four different types of checks.

oculow.set_comparison_logic(oculow.PIXEL_DIFF)
oculow.setComparisonLogic(oculow.PIXEL_DIFF)
oculow.setComparisonLogic(oculow.PIXEL_DIFF)

The three options are:

oculow.PIXEL_DIFF
oculow.IGNORE_AA
oculow.DETECT_ERRORS

Click here for more details on each comparison logic

Each type of comparison calculates the difference between the baseline and the new image in different ways.

Pixel difference
Will calculate the exact differences between the baseline and the new image. If a pixel is different, then the test will fail and the difference can be visualized in the dashboard.

Ignore anti aliasing effects
Will compare the base image and the new image, ignoring slight differences that a human cannot perceive. If there are perceptual differences in the image, the results can be visualized in the dashboard.

Beta: Detect errors
This will only detect errors in each website, ignoring the image comparison. If any errors are detected, they can be visualized in the dashboard.

Simple ui test example

from selenium import webdriver  
import oculow  
oculow.set_api_key( "FAKE_APIKEY" )  
oculow.set_app_id("oculow")  
oculow.set_baseline_management_level(oculow.ASSISTED)  
oculow.set_comparison_logic(oculow.PIXEL_DIFF)  
driver = webdriver.Chrome('./chromedriver')  
driver.get("http://www.oculow.com")  
assert "Oculow"  in driver.title  
oculow.capture_screen(driver, "Oculow Landing")  
oculow.dispose()  
driver.close()