How to work with dynamic properties?

In few scenarios, element attributes change dynamically. It can be ‘id’, ’name’ etc.

Example (For Mobile) : Let’s say the attribute ‘name’ of a username field is ‘12345’ and the XPath will be //*[@name=’12345′] 

But when you open the page again, the ‘name’ of ‘username’ field might have changed and the new value may be ‘23456’.

In this case, the test case will fail because the name ‘12345’ mentioned in the object property has now changed to some other value.

BQ Tool provides a simple way to handle the dynamic object.

Follow the below steps to fix this :

Option 1 : 

  1. Click on the icon displayed next to the object.
    The object property pop-up will be displayed. Change the value in object property column from ‘12345’ to ‘_bq_’



    Note : For Mobile Native, do not forget to select the checkbox for Android or iOS (according to the property used for the object).
  2. Once the value is changed to ‘_bq_’ , click on Update button and the property will be updated.
  3. Now, for this property to function as required, use an action keyword ‘copyStringValueTo’ just above the line that contains the changed object.
  4. Click on Data button displayed besides the action keyword ‘copyStringValueTo’.
  5. Store the desired value in ‘String to Store‘ field and enter ‘_bq_dynamic_attr_’ in the “In Variable” field.
      

  6. Save the test case and execute it.

Option 2 : 

  1. Use an action keyword ‘copyStringValueTo’ just above the line that contains the object that contains the dynamic value.
  2. Click on Data button displayed besides the action keyword ‘copyStringValueTo’.
  3. Store the desired value in ‘String to Store‘ field and enter the variable name (Ex. ‘pickUp’ ) in the “In Variable” field.


  4. Click on the icon displayed next to the object that contains the dynamic value.
    The object property pop-up will be displayed.
  5. This time instead of updating the value to ‘_bq_’ , update the variable name, within the curly braces, as the value (Ex. {{pickUp}})


  6. Click on the Update button.
  7. Save the test case.

Example (For Web) : Let’s say the attribute ‘name’ of a username field is ‘12345’ and the XPath will be //*[@name=’12345′] 

But when you open the page again, the ‘name’ of ‘username’ field might have changed and the new value may be ‘23456’.

In this case, the test case will fail because the name ‘12345’ mentioned in the object property has now changed to some other value.

Option 1 : 

Follow the below steps to fix this :

  1. Click on the icon displayed next to the object.
    The object property pop-up will be displayed. Change the value in object property column from ‘12345’ to ‘_bq_’


  2. Once the value is changed to ‘_bq_’ , click on Update button and the property will be updated.
  3. Now, for this property to function as required, use an action keyword ‘copyStringValueTo’ just above the line that contains the changed object.
  4. Click on Data button displayed besides the action keyword ‘copyStringValueTo’.
  5. Store the desired value in ‘String to Store‘ field and enter ‘_bq_dynamic_attr_’ in the “In Variable” field.
         

  6. Save the test case and execute it.

Option 2 : 

  1. Use an action keyword ‘copyStringValueTo’ just above the line that contains the object that contains the dynamic value.
  2. Click on Data button displayed besides the action keyword ‘copyStringValueTo’.
  3. Store the desired value in ‘String to Store‘ field and enter the variable name ( Ex. name ) in the “In Variable” field.


  4. Click on the icon displayed next to the object that contains the dynamic value.
    The object property pop-up will be displayed.
  5. This time instead of updating the value to ‘_bq_’ , update the variable name, within the curly braces, as the value ( Ex. {{name}} )


  6. Click on the Update button.
  7. Save the test case.