Results 1 to 4 of 4

Thread: Help needed testing around system dates in QTP.

  1. #1
    Junior Member
    Join Date
    Mar 2008
    Answers
    19

    Help needed testing around system dates in QTP.

    Hello all,

    I am currently automating my system at work and have come across a slight problem recording my test.

    I have completed all my script for the specific test, however i am having the following problem:

    When testing around adding new policies into our system, to edit the general information of the policy cover one must click on each cover individually in a 'Tree-type' view.

    When recording this piece of test the following line of code is recorded:

    VbWindow("MDIMain").VbWindow("frmPol_[0-9]+").ActiveX("ItemControl.ItemCtrl").VbTreeView("trvItem").Select "09/04/2008 [ PENDING ] - Inception -- Documents Outstanding --;WN General Information"

    My problem is with the date after select, this is the current system date and obviously updates everyday, thus causing QTP to stop when it encounters this.

    Is there a way to automate this so that Qtp can possibly recognize a range of dates on that line?

    any help would be greatly appreciated.

    Regards James.


  2. #2
    Junior Member
    Join Date
    Apr 2008
    Answers
    1

    Thumbs up Re: Help needed testing around system dates in QTP.

    Hi James,

    Try below steps and it should work.

    1. Get the system date For ex: Date
    (Date is a VB function, which returns date&time stamp like "04/08/2008 00:00:00")

    As you only required date...split the variable to get 1st part of date

    2. varDate = Split("Date"," ",-1) (This returns an array of values)
    3. varSysDate = varDate(0)

    Now you can use varSysDate in your code.

    Please let me know if this works.

    Regards


  3. #3

    Re: Help needed testing around system dates in QTP.

    ragasrip, your code will not work because "Date" does not return that value (the function "Now" returns what you have mentioned in your code).



    James, try the code in the .txt file. I had to make an attachment because it would just show as a single line on here.



    Attached Files Attached Files

  4. #4
    Junior Member
    Join Date
    Mar 2008
    Answers
    19

    Cool Re: Help needed testing around system dates in QTP.

    Thank you very much Anshoo,

    Your code was perfect for me and worked first time.

    this has really helped move my testing forward.

    thanks once again.

    James.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact