Ask a Question

check fields visiblility

MarinaB
Occasional Contributor

check fields visiblility

Can I make automation test that will verify do all fields exist (or not exist) at the form? And if I can how can I do that? Like example at the Form 20 fields exist. With the new version a new filed is added at the Form or example with the new version one field is not visible. What automated test can do?

3 REPLIES 3
SanderK
Occasional Contributor

This should get you on your way:

https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/checking-existence.html

 

Using the methods described there you could check whether said 20 fields exist on your form. To see if there are additional fields you could search for all fields of a certain type and see how many are returned. Keep in mind that a field can exist while being invisible. Therefore, it is wise to check the "Visible" or "VisibleOnScreen" property of each existing field.

AlexKaras
Champion Level 2

Hi,

 

TestComplete provides a set of .WaitXXX() methods (e.g. .WaitChild, .WaitAllChildren, WaitForm, etc.) that are recommended to be used to look for the objects when the sought for object may or may not exist.

.Visible and .VisibleOnScreen properties can be used to check if the given object is visible on screen.

 

Exact answer to your question significantly depends on the implementation of the tested application.

For example, if you are lucky and all fields at the form are named with, say, 'fld_' prefix, then you may search for all objects that start with that prefix, iterate through the returned objects list, check if the object is visible, compare the returned objects list with the previously saved 'master' one and report differences if any.

If you are not lucky and developers assigned random names to the fields, than you may search for the fields one by one. Obviously in this case it will be not possible to detect if the new field is added. You may use image comparison to detect new fields, but this is error prone way.

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
tristaanogre
Esteemed Contributor

Keep in mind that "Exists" could return true even if the item is not visible on screen.  In several of the Web Applications we're testing, there are certain modals that are present on the page but are marked not visible.  So, "Exists" would return true but "Visible" would not.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: