Dynamic variable with WPF recorder

3 posts, 0 answers
  1. Mark
    Mark avatar
    27 posts
    Member since:
    Nov 2011

    Posted 17 Jan 2013 Link to this post

    Hi all,

    I've recorded a test case and when i clicked in a button, here is the telerik code generated:
    Applications.MyAppexe.Bob_McLean_1162013.SuperbillTextblock.User.Click(xx.xxx.xxx)
    SuperbillTextblock is the name of my button
    I wonder why the WPF Telerik recorder has recorded the date of the day "1162013" (16th January 2013). It doesn't make any sense.
    Therefore, when I try to play back my script another day, it doesn't work.
    How can we make a dynamic variable with the date of the current day?

    Something like:
    Date currentDate = new Date(xxxx);
    Applications.MyAppexe.Bob_McLean_{currentDate}.SuperbillTextblock.User.Click(xx.xxx.xxx)


    I don't know the exact syntax but I'm sure it's possible to do it.
    Don't hesitate to tell me if you have a better idea to solve my issue.

    Thanks in advance for your help.
  2. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 22 Jan 2013 Link to this post

    Hello Mark,

    It seems that you are dealing with a dynamic WPF window title and the title name is based on the current date. In order to make this to work every time you run the test, you need to change the Caption property for the WPF Window. Use tilde (~) to indicate a partial match. See here for more information.

    For example, if the value of the Caption property is:
    Bob_McLean_1162013
     

    You can change it to:
    ~Bob_McLean_
     
    Please give it a try and let me know if it works.

    All the best,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Mark
    Mark avatar
    27 posts
    Member since:
    Nov 2011

    Posted 23 Jan 2013 Link to this post

    Thanks a lot Plamen. Now it works.
Back to Top