QF test Dynamic Components whithout IDs

603 Views Asked by At

I am testing a Software using Qf test the Components are dynamic and has no ID, we tried xpath but the Html tree is complicated. Do you have any ideas how to handle that in Qf test with step explanation???

1

There are 1 best solutions below

0
On

The easiest way to do this, if you only have one or few of such dynamic components:

  1. Open a new test suites (Ctrl+N)
  2. Record a mouse click / check event onto your dynamic component into this new suite.
  3. Refresh your browser page (or do whatever is needed to be done so that the component changes).
  4. Open a second (new) test suite (Ctrl+N)
  5. Record another mouse click / check event onto your dynamic component into the second new suite.

You are now having two suites. Both of your suites are basically looking like this:

+ Testset: unknown
  + Testcase: unknown
+ Procedures
+ Extras
  + Recording ...
    + Mouse click
      QF-Test component ID: someText
+ Window and components
  + Window
    + ... some nodes ...
      + Component
        QF-Test ID: someText

It is important to notice, that the QF-Test component ID of your mouse click has the same id/string as the QF-Test ID of the component node below your "Window and components" node. This is because the "Window and components" node is representing some kind of database. Whenever a mouse click/text replay/check/... node gets replayed QF-Test will search for a component node (below the the "Window and components" node) with this id/string. QF-Test will then try to find the component in your GUI based on the recognition information that is provided in this component node AND the parents of this component node. Interesting details about this recognition algorithm are described in the handbook. The most important chapters are:

So by having a look at the differences between multiple (two) recordings it is often possible to come up with a component hierarchy that is describing your wanted components. The most easiest way to do so in general is to delete all intermediate parent nodes. So

+ Window and components
  + Window
    + ... some nodes ...
      + Component
        QF-Test ID: someText

is becoming

+ Window and components
  + Window
    + Component
      QF-Test ID: someText

Then compare all Features, Extra Features and other attributes of this component node and the Window node in the two suites. Delete those that are not the same in both suites, except for the "QF-Test ID" attribute. Here choose a speaking name for your component. Now you can use the chosen speaking name in the "QF-Test component attribute" of mouse clicks etc. nodes.

Normally this is it. However it can happen that the occurring component description is now matching too many components in your application to test. In this case, Extra Features etc. need to get added again until the recognition becomes as stable as wanted.

In case you have multiple of such components, the recording of QF-Test can be adapted to your needs via Resolver scripts. With resolver scripts it is possible to modify the recording, such that certain Window/component nodes will not be recorded, or that certain Features/Extra features will be recorded differently and so on.