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:
[COLOR="Red"]VbWindow("MDIMain").VbWindow("frmPol_[0-9]+").ActiveX("ItemControl.ItemCtrl").VbTreeView("trvItem").Select "09/04/2008 [ PENDING ] - Inception -- Documents Outstanding --;WN General Information"[/COLOR]
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.
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
1 Attachment(s)
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).
<br>
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.
<br>
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.