Forum Discussion

techgirlbb's avatar
techgirlbb
Contributor
7 years ago
Solved

How to validate "cusomerAge" using property checkpoint

Hi, I am working citix application.on customer  page, text filed prepoulated cusomer age based on the DOB I have given in other field.

qs: I  inserted a checkpoint to verify  the age, i want to make that as checkpoint variable and make it work for all sets of data.

I have thought of creating new function and comparing ..but my team is non technical they don't want any code in between..

any better solution?

 

 

  • In the "Value" part of the property checkpoint, after it's been inserted, you can change the type of data to a "Code Expression" and then use various parts of the aqDateTime object to calculate someones age based upon DOB.  Specifically, look into using the TimeInterval method (https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqdatetime/timeinterval.html).  

     

    While I understand the desire to not have "code", when you start getting into making tests "smarter" where they calculate and compare things to be more variable, you'll need to start working with some sort of code.

     

    An alternative to a code expression is to use "Call Object Method" to call the different methods of aqDateTime to do the calculations as keyword operations but I personally find that more cumbersome.  It's doable but it will mean adding a lot of operations to your test simply to do the calculation that can be done with a single code expression.

1 Reply

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    In the "Value" part of the property checkpoint, after it's been inserted, you can change the type of data to a "Code Expression" and then use various parts of the aqDateTime object to calculate someones age based upon DOB.  Specifically, look into using the TimeInterval method (https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqdatetime/timeinterval.html).  

     

    While I understand the desire to not have "code", when you start getting into making tests "smarter" where they calculate and compare things to be more variable, you'll need to start working with some sort of code.

     

    An alternative to a code expression is to use "Call Object Method" to call the different methods of aqDateTime to do the calculations as keyword operations but I personally find that more cumbersome.  It's doable but it will mean adding a lot of operations to your test simply to do the calculation that can be done with a single code expression.