Question

Hy,

Is it possible to test mxGraphs via UI by using Quick Test Professional?

Was it helpful?

Solution

Assuming you mean mxGraphs (a link would be nice next time) as javascript library for drawing diagrams in the webbrowser:

Using the example application: It is possible, but poorly. All basic shapes on the left side are selectable and have unique names by their "alt" property or "filename" property. The buttons on top are recognizable by QTP, but results in generic creation of object names, you'll have to fiddle with the Class attributes if you want to use the,.

Recording example (on dutch culture):

' left-side objects
Browser("Diagramly - Draw Diagrams").Page("Diagramly - Draw Diagrams").Image("Container").Click
Browser("Diagramly - Draw Diagrams").Page("Diagramly - Draw Diagrams").Image("Tekst").Click

' changing the text on the Tekst object
Browser("Diagramly - Draw Diagrams").Page("Diagramly - Draw Diagrams").WebEdit("WebEdit").Set "Change of Text"

' More new objects
Browser("Diagramly - Draw Diagrams").Page("Diagramly - Draw Diagrams").Image("Signal-in Arrow").Click
Browser("Diagramly - Draw Diagrams").Page("Diagramly - Draw Diagrams").Image("Corporate Data Center").Click

' Changing text on the Corporate Data Center object
Browser("Diagramly - Draw Diagrams").Page("Diagramly - Draw Diagrams").WebEdit("WebEdit").Set "new text"

' Top buttons
Browser("Diagramly - Draw Diagrams").Page("Diagramly - Draw Diagrams").WebButton("WebButton").Click
Browser("Diagramly - Draw Diagrams").Page("Diagramly - Draw Diagrams").Frame("Frame").WebButton("Annuleren").Click
Browser("Diagramly - Draw Diagrams").Page("Diagramly - Draw Diagrams").WebButton("WebButton_2").Click
Browser("Diagramly - Draw Diagrams").Page("Diagramly - Draw Diagrams").WebButton("WebButton_3").Click

The canvas (drawing area) is a different story. Drag and Drop is not easily automatable because it is not recognized nativly. You have to write your own functions for that.

Shape recognition is only doable on properties in the innerHtml, or the x and y locations. If you want to do extensive creation and changing/editing of objects, then you could create a library with all objects kept in it as sort of virtual objects, remembering the state of each objects. But is won't be easy.

Tested on WinXP SP3, IE8 and QTP10.00

TL;DR No. Some components can be captured by QTP, but it will be tiresome and slow. It will only be worth the effort if you only want to see if all items on the side-bar are present and can be created.

OTHER TIPS

It is doable. The way that we achieve something similar was to ensure that you have the window of the a fixed size and of fixed resolution. To check the results we just did a binary diff on what was expected and a screen shot (used the browser at full screen).

Not the best solution - but kinda worked most of the time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top