Your e-Business Quality Partner eValid™ -- The Web Quality Suite
Browser-Based, Client-Side, Functional Testing & Validation, Load & Performance Tuning, Page Timing, Website Analysis, and Rich Internet Application Monitoring.

eValid -- Structural Testing With DOM Commands -- Validate One Item Matches Another
eValid Home

Background
The eValid DOM index/motion algorithmic/structural testing capability makes it possible to produce robust tests which behave independently of page specifics.

Use of the DOM Manipulation Resources leads to tests that are able to operate at a level of abstraction above that of the usual eValid command level. This example is one of a series that illustrate how this process works. Please see the Guide To Examples for the complete set.

Description of Tested Feature
This example excerpt manipulations a web application's generated REPORT output data. Typically, one inputs and selects the necessary available options and then clicks on a submit button to generate the wanted SUMMARY reports. The results are then extracted and compared/validated with other expected fields.

Index/Motion Command Sequence
Here is the command sequence that achieves the result:

...
ValueSet 0
SyncOnText 0 "name" "frame"
IndexSetEnd 0 "frame"
IndexFindElement 0 UP "innerText" "name" "frame"
IndexMove -2
ValueGetElement 0 "innerText" "frame"
ValueSave "file1.txt"
... 
ValueSet 0
SyncOnText 0 "name" "frame"
IndexSet 0
IndexFindElement 0 DOWN "innerText" "name " "frame"
IndexMove +2
ValueGetElement 0 "innerText" "frame"
ValueSave "file2.txt"
... 
CompareImages "file1.txt" "file2.txt"
... 

eValid Script
Here is an excerpt from an example eValid script that contained a validate/match action.

...
ProjectID "Project"
GroupID "Test"
TestID "example14"
LogID "AUTO"

...
# Go to your web application and perform options/selections to 
# generate your summary reports data:
#
# Enhanced using DOM synchronization and index commands below...
# Recorded commands are marked with "##"...
#
Wait 125
FollowLink 0 53 " " "javascript: formCheck();" ""
##Wait 5766
SyncOnElementProperty 0 "id" "modImg_1" "number:0"
##ElementClick 0 82 147 77 "modImg_1" "" "number:0"
IndexSet 0
IndexFindElement 0 DOWN "id" "modImg_1" "number:0"
IndexElementClick 0 "number:0"
Wait 1813
SyncOnSelectedObjProperty 0 0 "id" "dynMenuCell_0" "innerText" "Category" "number:0"
##ElementClick 0 114 35 109 "dynMenuCell_7" "Category" "number:0" NAV
IndexSet 0
IndexFindElement 0 DOWN "innerText" "Category" "number:0"
IndexElementClick 0 "number:0"
Wait 1937
SyncOnSelectedObjProperty 0 0 "id" "nowShowing" "innerText" "Sales: Category Report" "number:0"
SyncOnElementProperty 0 "id" "_POSId" "number:1"
##InputValue 0 259 "SELECT-ONE" "_POSId" "_POSId" "Chart" \
##	"er's Cafe" "1" "number:1"
IndexSet 0
IndexFindElement 0 DOWN "id" "_POSId" "number:1"
IndexInputValue 0 "SELECT-ONE" "Charter's Cafe" "1" "number:1"
##Wait 5782
SyncOnText 0 "MEAL PERIOD" "number:1"
SyncOnText 0 "4 Banquet" "number:1"
##InputValue 0 3101 "CHECKBOX" "4||REVENUE CENTER||1 Dining" "rvc" "127239" \
##	"1" "TRUE" "number:1"
IndexSet 0
IndexFindElement 0 DOWN "id" "4||REVENUE CENTER||1 Dining" "number:1"
IndexInputValue 0 "CHECKBOX" "1" "TRUE" "number:1"
Wait 2937
FollowLink 0 3159 "" "javascript:getReport()" "number:1"
##Wait 24328

# ADDED Structural command sequences to extract VALUE #1...
#------------------------------------------------------------------------
ValueSet 0
SyncOnText 0 "Total Gross Sales" "number:1"
IndexSetEnd 0 "number:1"
IndexFindElement 0 UP "innerText" "100%" "number:1"
IndexMove -2
ValueGetElement 0 "innerText" "number:1"
ValueSave "total1.txt"
#------------------------------------------------------------------------

# Process actions to get the match results...
SyncOnElementProperty 0 "id" "modImg_2" "number:0"
ElementClick 0 84 241 75 "modImg_2" "" "number:0"
##Wait 5141
SyncOnSelectedObjProperty 0 0 "id" "dynMenuCell_14" "innerText" "Summary" "number:0"
##ElementClick 0 129 62 108 "dynMenuCell_14" "Summary" "number:0" NAV
IndexSet 0
IndexFindElement 0 DOWN "innerText" "Summary" "number:0" 
IndexElementClick 0 "number:0"

# ADDED Structural command sequences to extract VALUE #2...
#------------------------------------------------------------------------
SyncOnSelectedObjProperty 0 0 "id" "nowShowing" "innerText" "Service: Summary Report" "number:0"
ValueSet 0
SyncOnText 0 "Total:" "number:1"
SyncOnText 0 "Average:" "number:1"
IndexSet 0
IndexFindElement 0 DOWN "innerText" "Total: " "number:1"
IndexMove +2
ValueGetElement 0 "innerText" "number:1"
ValueSave "total2.txt"
#------------------------------------------------------------------------

CompareImages "total1.txt" "total2.txt"

# Logout...
##Delay 30000
Wait 4719
SyncOnElementProperty 0 "alt" "Logout" "number:0"
##ElementClick 0 57 1112 10 "" "" "number:0" NAV
IndexSet 0
IndexFindElement 0 DOWN "id" "modDivButton_0" "number:0"
IndexMove +1
IndexElementClick 0 "number:0"
...
...

How It Works
This excerpt demonstrates how one can combine the various available INDEX MOTION features to find and extract data field(s) and then compare that baseline with a generated response query field in any summary reports webpage. Please note here that the "value" must be an assigned ASCII TEXT string and not an image of such a string.