cancel
Showing results for 
Search instead for 
Did you mean: 

Set the value of an object property in Name Map to a variable value.

SOLVED
Highlighted
Frequent Contributor

Set the value of an object property in Name Map to a variable value.

Hi.  I have a web based, keyword test that is giving me some trouble.  I am testing security roles for different users for an application.  Depending on who I am testing as, objects may or may not display in the UI.  In addition, one user may see an Info button where another will see an Edit button for example.

I have attached an example of what a role might seebelow. 

Photo1.jpg

 

The EDIT buttons are giving me the trouble.  Specifically, I need to be able to identify that a user can edit Next Performance Review Date or Business Continuity Team but I have no way of identifying these button every time as the button properties all change based on user.  So TC has a hard time differentiating the different Edit buttons from the mapped button due to the properties always changing. 

 

 

Here’s what I do have:

The Next Performance Review Date and Business Continuity Team sections I can easily identify by their contentText Property.  So I have no trouble finding those.  Additionally, based on being able to find this, I can very easily determine the ID’s of these sections, which is an integer ranging from 0 – 40 depending on the number of objects displayed.

Photo2.jpg     Photo3.jpgAgain, this ID changes depending on what else displays.  I know that the ID of the corresponding Edit button is NextPerfomanceReviwDate.ID +1 for it’s corresponding Edit button and BusinessContinuityTeam.ID +1 for it’s corresponding Edit button.   So in the screenshots above, the ID for the Next Performance Review Date section is 10.  It’s corresponding Edit button ID is 11.  Again, these are not the same for each role I need to test, nor are the other properties but the button ID is always one more than the ID of it's corresponding Object.

 

Using the Set Variable Value operation in the Keyword Test operations, I was able to create a temporary variable to be NextPerfomanceReviwDate.ID +1.  I was hoping to be able to assign this to the ID property of my Edit button in Name Mapping.

Is there a way to assign the ID property of my object mapped for the Edit button to be = to the variable I created for NextPerfomanceReviwDate.ID + 1?

 

Any other suggestions? 

 

Thank you for your time!

 

Dave.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Frequent Contributor

Re: Set the value of an object property in Name Map to a variable value.

Thanks, @Marsha_R .  Can you please elaborate a bit more on your recomendation to construct the object name?  I'm not sure I'm following you, but it sounds like a much simpler solution.  

4 REPLIES 4
Community Hero

Re: Set the value of an object property in Name Map to a variable value.

You can get to your object without resetting the Name Mapping.  Just use your your variable to construct the object name instead of referencing the mapping.

 

However, if you're really set on updating the mapping, use this function so it resets automatically. 

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/refres...

Frequent Contributor

Re: Set the value of an object property in Name Map to a variable value.

Thanks, @Marsha_R .  Can you please elaborate a bit more on your recomendation to construct the object name?  I'm not sure I'm following you, but it sounds like a much simpler solution.  

Community Hero

Re: Set the value of an object property in Name Map to a variable value.

If you can identify the parents and there is only one child button, can you not just find the first button available instead of relying on the id property? Seems like a much more simple way of finding the button. 

 

Screenshots of the both sections and their buttons in the object browser would also help determine a better course of action. 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
Frequent Contributor

Re: Set the value of an object property in Name Map to a variable value.

@Marsha_R  - I got this figured out and it's working great.  I had my variable assigned on the test rather than at the project level.  Thanks again for your suggestion! 

New Here?
Join us and watch the welcome video: