Geeks With Blogs
Maryanne's Blog Another Geek with A Blog

I was working on a script yesterday and came accross a challenge I hadn't encountered yet in my automation scripting adventures.

The page I was working on displays the dates of various status changes for the objects under test.  So for example there were two dates on the page.  One associated with when the object was created and the second was when the object status changed.

And seeing as I have a strong manual QA background I thought...I can validate those dates NO problem.  I know where they are stored in the DB and I can just compare them using QTP's table checkpoint procedures. (Which I've TOTALLY taken to btw)

When I started investigating this, I found a small problem.  The Database stores the date like this:  2007-05-21 14:51:00 but the Application is going to display that date like 5/21/2007.

So..what's an automation engineer to do? 

Well..First I pinged my buddy who used to work at this company with me and we keep in touch via IM pretty consistently.  He had several suggestions, the first of which was try to try the FormatDateTime VBscript command. 

Now granted this solution does have a weakness...if your localization settings are changed for some reason this may not work b/c FormatDateTime uses your PC's locale settings to determine date formats.

However, since I have total control over the machines these scripts are running on I can set the Shortdate format on the PC to be the format I need it to be in to convert the date into a useful format.

So I used this function FormatDateTime to convert the SQL date into the shortDate, stored it out into the DataSheet and then used the QTP tablecheckpoint to confirm the date in the App was correct.

Easy Peasy, Lemon Squeezy!

<YAY!>   <cheers for her bud's genius>

Posted on Tuesday, June 26, 2007 10:28 AM QuickTest Pro | Back to top


Comments on this post: Date compares between App display and Database Storage

# re: Date compares between App display and Database Storage
Requesting Gravatar...
Maryanne
Its great to see another medium-to-advanced QTP user blogging. You make me want to start blogging about my QTP experiences too. Some folks called the 'softwareinquisition' had a pretty good quasi-blog up last year about QTP but it has since disappeared. If I had 3 secs to give you advice it would be 'forget checkpoints- look at the QTP function GetROProperty as in 'object.Get [runtimeObject] Property'' cheers Mike from Maryland
Left by Mike from Maryland on Jun 26, 2007 6:20 PM

# re: Date compares between App display and Database Storage
Requesting Gravatar...
I have used the GetROProperty function in cases where I think the archecture isn't stabilized. However, the application where I'm using these table checkpoints is for the most part incredibly stable so I feel comfortable that the structure of the HTML page is not going to change. And if it does, the automation team is going to be abreast of that change (thanks to ongoing work order reviews prior to acceptance by the Manual QA Team) and therefore would allow for plenty of time to update the scripts.

I have considered composing a custom function which would do what GetROProperty would do but over an entire table..but Boss man's thought is why reinvent the wheel if QTP's method is reliable.

And for now, it is.

NOW TEXT CHECKPOINTS on the other hand are an ENTIRELY DIFFERENT ANIMAL...gripes about that to come later...
Left by Maryanne Sweat on Jun 26, 2007 7:11 PM

Your comment:
 (will show your gravatar)


Copyright © Maryanne Sweat | Powered by: GeeksWithBlogs.net