Forum Discussion

Andrew_x's avatar
14 years ago
Solved

use a variable as the expected text in a Property Checkpoint for a Keyword test?

When adding a property checkpoint in a keyword test, how can you use a variable as the value to compare (instead of a hardcoded value).



I've added a property checkpoint to my keyword test, and I want to have the expected value taken from a variable.  But the wizard for the checkpoint automatically puts quotes around my code calling the variable, therefore it takes the string literally instead of the value of the variable. 



NOTE: I can get this working in a script, but not in the Keyword test.



The way the code looks for the checkpoint is:



From Keyword Test: 



  • Aliases.Licence.LabelValue.Name, "wText", cmpEqual, "KeywordTests.VerifyLicence.Variables.AddLicence("Licence_Name")", False


From Script (Which works):




  • Call aqObject.CheckProperty(Aliases.Licence.LabelValue.Name, "wText", 0, KeywordTests.VerifyLicence.Variables.AddLicence("Licence_Name"), False)




Notice the quotes around the portion where I'm attempting to use the variable in the keyword test checkpoint.

  • tristaanogre's avatar
    tristaanogre
    5 years ago

    Actually....

    While it's not available when going through the wizard, you can go back in after the checkpoint is created and set the "Value" property to be a variable.

6 Replies

  • Hi Andrew,



    When adding a property checkpoint in a keyword test, how can you use a variable as the value to compare (instead of a hardcoded value).


    Currently, it is not possible by default. I have added a suggestion to implement this ability to our DB. As for now, you can try calling the working code snippet using the Run Code Snippet  
    operation.
  • "Currently, it is not possible by default.  I have added a suggestion to implement this ability to our DB."



    Is this still the case?  I notice this was posted over a year ago.  I'm using version 8.60.

    Thanks
  • Hi Rich,



    At this moment, the suggestion has not been implemented yet. Your message has increased its rating.



    Please try using the workaround suggested by Andrew.
    • DSmachineWorld's avatar
      DSmachineWorld
      Contributor

      Eight or so years, and I'm guessing it's not implemented yet?

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Actually....

        While it's not available when going through the wizard, you can go back in after the checkpoint is created and set the "Value" property to be a variable.