Forum Discussion

jw25's avatar
jw25
Occasional Contributor
3 years ago

Need help comparing orderID on a second page

Hello,

 

I'm trying to create a keyword test where after completing an order, there is a orderID that gets displayed. On that same page there Is a link that will take an user to the details of the order. Here the number gets displayed once again. I want to make the test in such a way that It checks if both of these orderID numbers are the same.

 

So far I've created a temporary project variable. I use this variable at the beginning of the test to store the value of the orderID. To do this, I've created a set variable command with the mode of object property, using on screen object. I get a few options to choose as value, but none of them have the number, except the clipboard value. This value beeing: Aliases.browser.pageAtaroBvReserveren.textnodeReserveringsnummer7911.MappedName

 

After making the test go the orderdetails page, I've used a property checkpoint using the same proces as before. And comparing the value to the variable with cmpEqual. The value I get out of this is: Aliases.browser.pageAtaroBvBesteldetails.textnodeBestelling7911.MappedName

 

Now In both of these, the number is the same. How do I get It to ignore everything else but the number?

  • Marsha_R 

    I figured out the problem. It couldn't find the parent object because the parent object had the wrong namemapping. It was still looking for an URL with the ID inside of it. I changed the object ID nummer to be anything using the *. However since this second number was inside a parent, it was still looking for the specific number because the parents namemapping was unaltered. 

     

    So by changing the namemapping using an *, the test now works as it should. 

     

    Thanks alot for your help and patience!

    • jw25's avatar
      jw25
      Occasional Contributor

      Hello Marsha_R ,

       

      Thanks for replying, I've managed to make alot of progres using aqScripts. However Its still not entirely working as intended. There is one vital step that is still missing from the test. 

      Currently at the set variable value, It takes the value just once. I was hoping that It would repeat this step everytime the test runs. That way the number would update automatically and everything would work. Now I would have to manually change the number for Testcomplete, whenever the orderID has changed. So basically the test works, as It compares the orderID to the second orderID on the next page. But the variable never updates, so Its comparing the old orderID, not whatever the current orderID is. 

       

      I'm also worried that if there is a way for It to update the orderID automatically, It will not include the value in quotation marks. If It doesn't do that, It wont be able to store It in the string variable I've made for It. Although I'd imagine aqConvert plays a role in this possible problem. I'm also including a screenshot of one of the scripts I've made, so you can see exactly what I'm working with. The other script does the same thing but for the other orderID.

       

      • Marsha_R's avatar
        Marsha_R
        Moderator

        From your screenshot, it looks like you have hard coded the string value.  The Set Variable Value is indeed setting the variable every time you run the test, but you have told it to set the exact same value every time.

         

        What you need to do is use the object property for that field that contains the text you want to compare.  By telling TestComplete to use the object property, TestComplete will always find the current value.  

        https://support.smartbear.com/testcomplete/docs/testing-with/exploring-apps/object-spy/index.html

         

        Inside Set Variable Value, you will see a choice for Object Property, so there is no problem using it there or getting the string that you need.