How to traverse to a child object from a parent object using in test-complete tool? - testcomplete

I am automating a mobile application using TestComplete tool. I have to get the text of an object from the UI, but the object id keep on changing while change of values. So is there any option in test complete which support -following-sibling or Child Property which exist in selenium tool. So that we can easily traverse from a parent object to track the child or sibling. Please help.

You need to find a property or a set of properties that will uniquely identify the needed object without using its native id. Use these identification criteria to set up the corresponding Name Mapping scheme for this object.
PS. Of course, having a permanent ID for a UI object is the best way to automate tests with the object.

Related

Warning: The object was not found using the test object description. Check the object's properties

I'm currently studying UFT. I encountered this: I have one object, which is a textbox field on my repository. I used that specific object twice on my script. The warning then occurs. "The object was not found using the test object description. Check the object's properties." May I know what to do so that warning will no longer occur?
This warning means that UFT was not able to identify the object using the primary description it stored and that a fallback method called Smart Identification was used.
This means that the identification properties that you're currently using (either Object Repository or descriptive programming) are out of sync with your web application and it's recommended that you update the description (perhaps by adding regular expressions).
The report should list which properties where used by Smart Identification and which were skipped), this may be a good starting point to choosing your description.

How to delete entity and its dependencies programmatically?

My client have asked me to delete a custom entity and its dependencies (which prevents deletion of this entity) programmatically.
I have retrieved the dependencies of the custom entity using RetrieveDependenciesForDeleteRequest. This request is giving me the collection of dependencies, which must be deleted before the deletion of that custom entity.
RetrieveDependenciesForDeleteResponse resp =
(RetrieveDependenciesForDeleteResponse) service.Execute(req);
//A more complete report requires more code
foreach (Entity dependencyEntity in resp.EntityCollection.Entities)
{
service.Delete(d.LogicalName, dependencyEntity.Id);
}
Now the issue I am facing here is that dependencyEntity.Id is always empty GUID, instead of valid GUID.
Can some one help me how to achieve this functionality?
The Entity items in the response merely act as data transport objects. They are not real entities. What you are looking for is the attribute named "dependentcomponentobjectid" (this is a Guid type, not an EntityReference). Attribute "dependentcomponenttype" (OptionSetValue) gives you a clue about the type of the component you are dealing with.
Note that a dependentcomponent can in turn be a required component other components are depending on. (E.g. a workflow depends on a workflow activity, which in turn depends on a plugin assembly.) So, a robust removal tool would need to follow a recursive strategy.

How to push a value of an unchanged field into the target in a plugin's input parameters?

I'm deleting an instance of an entity and depending on the value of an option set in it, I wish to carry our different course of action. The problem is that the field isn't changed, hence, not provided to the plugin's target.
How can I easily tell the stupid plugin to fetch all the fields?
The way I do it now is to use pre-image but I'll be showing the plugin to some rookies and they will definitely not like it. And they won't believe me that's the way to go, for sure, because they're a cocky bunch.
Is there a work-around for that?
Using the pre-image is the suggested way in this scenario, the alternative is to instantiate a service factory in order to get an IOrganizationService and retrieve the entity using the target's Id.
It is part of the IPluginExecutionContext (of which Target is one part.) I think the beginners are confused if they think of Target as anything more than a property of IPluginExecutionContext.
It wouldn't make sense to have these values as part of Target, because then it would cause an update of the field to its current value - if you forced it into Target you would see the update in the audit details.
Thus, CRM has PreEntityImages, Target, and PostEntityImages, if Target was used the way "they" want it would not be able to differentiate between values being updated, previous values, and the final result of the entity.

RestKit can't map keys that don't exist in the source representation?

stack guys.
Recently, I process the net request with restkit, but if I want to add some key-value pairs that doesn't exist in the source representation, (such as the "userid", which is for user switch), I must add this in the success block, this is very boring. So, is there any convenient way to solve this?
Your best option is probably to override willSave method in your managed object subclass and, if the id isn't set, create and set it. This will update the objects during the mapping process (and is a lot easier than editing the JSON).

Can multiple ProgIDs point to the same ClsID?

I am working on a set of what are essentially plugins, which are COM servers. Each plugin has a set of configuration data which is managed by another component, the primary key to the configuration data is the plug-in's ProgID. When the plugin needs to access a configuration item, it makes a call and passes in its ProgID and the name of the property required. This is a legacy design and I must maintain backward compatibility.
I now have a requirement to load multiple instances of each plugin, with each instance having a different set of configuration data. The solution I'm considering is to create multiple unique ProgIDs for each plugin, each ProgID would point to the single ClsId for the plugin. Thus, each instance of the plugin would be indentified by its ProgID, the ProgID is still used as the primary key for the configuration data and everything is 100% backward compatible.
So, the questions:
Is this an acceptable technique? (multiple ProgIDs all pointing to a single ClsID).
When my plugin loads, would it be able to tell which ProgID was used to create it?
Prog ids are typically used in two ways: to detect a class id corresponding to a prog id (CLSIDFromProgID() function) - this is used to later call CoCreateInstance() - and to detect a prog id for a given class id - this is usually used to display a human-friendly version of a class id.
Those mappings imply that there's a HKCR{ProgId}\CLSID key with a default value equal to the class id and a HKCR\CLSID{classid}\ProgID key with a default value equal to the ProgId, which means that the mapping is one-to-one. You will just not be able to have more than one prog id under one class id.
A COM component is loaded by calling CoCreateInstance() which is passed a class id - obtained by any means possible, using CLSIDFromProgID() included. There're no ways for a component to tell how the class id was obtained.

Resources