How to Use Applitools Visual Validation with UFT

How to Use Applitools Visual Validation with UFT

In my last video, I mentioned that I recently interviewed Adam Carmi from Applitools on my TestTalks Podcast, and showed how to use Applitools with Selenium, Java and Maven.

In this video, I’m going to show you how to use Applitools with UFT.



  • Select your automation environment
    • Selenium (including Protractor & Capybara)
    • Appium
    • HP UFT / QTP
    • Microsoft CodedUI
    • Other


  • Select your development language:

    UFT /QTP

  • Install SDK:
    • Download the latest SDK of Applitools Eyes for UFT from here and extract it into a folder of your choice.
    • Associate the Eyes.qfl function library located in the extracted folder with your test in File > Settings > Resources > +.
    • If you want Eyes to be included in all tests, make sure to check ‘Set As Default’


 

Once you have configured the Applitools Eyes SDK for UFT next you create a test script. You can also configure Applitools to store the eyes.qfl in a Quality Center resource if you wanted. Check out the Applitools UFT SDK Guide page 4 for more info.

 


 

  • Build your first test

For this example I’m going to be using my test web site, but you can use any application and not just browser based ones. For example you could create test against windows based application as well like notepad.

  • First I’m going to navigate to my site:

Set IE = CreateObject(“InternetExplorer.Application”) 
    IE.Toolbar = false

IE.Visible = true
IE.Navigate https://www.joecolantonio.com/SeleniumTestPage.html

Add the about “Choose..” dropdown and the ans field to your object repository.



Then add the following code to select Version from the dropdown and get the value populated in the ans field.

Set mainPath = Browser(“Selenium WebDriver Validation”).Page(“Selenium WebDriver Validation”) 
    mainPath.WebList(“about”).Select “Version”
    versionInfo = mainPath.WebEdit(“ans”).GetROProperty(“value”)
    print versionInfo

  • Configuring the eyes object.

Next I’m going to add eyes and config it to use my API user specific API key (your will be different)

eyes.ApiKey = “Joe989898989JoeAutomationAwesomnessTEst231213232”

  • Starting a test.

Next you need to start a test using the eyes.open method:

   eyes.SetBaselineInfoFromWindow(mainPath)
eyes.Open “Selenium Webdriver Validation”,“ApplitoolsUFTDemo”

  • Adding UI validation checks.

Now we will add a visual validation check to our script using the CheckObject method

 eyes.CheckObject mainPath, “Joe Check 1”

  • Finishing and closing the test before reviewing the results.

Last just close the eyes object and add report the results in UFT.

   eyes.Close()

‘ Report
If Not eyesReport.IsPassed Then
If eyesReport.IsNew Then
Reporter.ReportEvent micFail, eyesReport.TestName, “New test inserted, See “ & eyesReport.Url & ” for details.”
else
Reporter.ReportEvent micFail, eyesReport.TestName, “See “ & eyesReport.Url & ” for details.”
End If
End If

Your full test script should look like this


 

  • Analyze Test Results

The first time you run the test, Applitools will create a baseline image and store it on their cloud based server.

If you run the test again, another image will be captured and compared to the baseline. If any differences are found they will be highlighted as conflicts.

To see this, rerun our sample test script. Notice that an error occurred. If you look at the Run Results report in the HP Run Results Viewer there is a URL to the Applitools image that contains the conflict. Let’s navigate to it.


 

The image check will show any conflicts found.


At that point you have a few options:

  • Accept the change
  • Reject the change
  • Report a bug
  • Add some ignore regions over any dynamic data that your application might have


1comment
Click here to add a comment

Leave a comment: