Contributions
Re: Unable to find object in a grid in Windows application
When you use Object Spy to identify your grid, do you have a property called "wValue" or something like that as part of the grid? It probably has a button called "Params" next to it. So you might be able to use something like: myGrid.wValue(2,0) That might get you access the cell itself, but then we still need to verify what you actually need to verify. I can't find a "color" property in the grids I use, but I'm wondering if there are any other differences between the 'phone' icons you need to differentiate between. If there is a difference in size (my 'read' icon is 20 pixels wide, but my 'unread' is only 15), you could use if(myGrid.wValue(2,0).Width==15) //do something But once you can look into the cell values, you might be able to find some other differences that, while not technically telling you if the color of your image is black, might still tell you what you need to know. For example, if you're REALLY lucky, the devs might have used the "Tag" property to differentiate between different phone statuses or types or whatever.1.7KViews0likes4CommentsRe: Refactoring - Replacing operations in Keyword Tests
Yeah, when I first started my current project, all of our existing tests were keyword tests. They were horrible - mouse clicks were tied to screen coordinates rather than objects, and trying to fix them (for any reason) would make my head explode. Fortunately for me, I was the only one on the project at that point, so I was able to throw them out entirely and start from scratch using scripts. Much easier to edit, and MUCH easier to write smaller routines for things like "Save and close form" that can be reused throughout the test.1.8KViews0likes0CommentsRe: Wait for form to load
It looks like your best bet would probably be to use the WaitAliasChild method, and the Exists property, along with a RefreshMappingInfo call. It ends up looking like this: var w = Aliases.mySoftware.myForm.WaitAliasChild("myControl", 10000); if (!w.Exists) mySoftware.RefreshMappingInfo; So, in the case of your code, it would probably be something like: var w = Aliases.M3_AKShell.frmMainVsd.tableLayoutPanel1. dockPanel.DockWindow.DockPane.Holder.AP.tabAP. tpVendor.tscVendor.ToolStripContentPanel.tlpVendor. pnlVendorGrids.WaitAliasChild("dgvVendorDetails", 10000) /*If statement is optional - if you're having trouble getting name mapping to work, include it, otherwise disregard*/ if (!w.Exists) mySoftware.RefreshMappingInfo; Good luck!568Views1like0CommentsRe: Financial Troubles?
Okay, here's what I ended up doing - for now at least, for anyone who is interested. I created a simple function: function handleFloats(num) { /*Multiplies num by 10,000, rounds it ot the nearest integer, then divides by 10,000 in an attempt to set it at 4 decimals.*/ var result = Math.round(num*10000)/10000; return result; } It's a bit kludgey, but it will do for now, at least.1.2KViews0likes0CommentsRe: Financial Troubles?
Let me clarify my previous response a bit. As far as I can tell, there is no way to explicitly cast a variable as any specific type in any of the lanugages supported by TestComplete, except DelphiScript and VBScript. In the case of DelphiScript, the only base types it supports are integer, float, boolean and string. Which leaves me with VBScript. According to Microsoft, VBScript does support a currency data type (but still no decimal), so that would work as far as that goes. But in researching this, I couldn't help but notice that 'currency' only goes to 4 decimal places. Does that mean that I could, theoretically, get a similar (if not equal) level of precision by just rounding my floats to 4 decimal places? That would certainly be a lot easier than trying to refactor my scripts. And if I can get a sense that this is generally accepted as a "good enough" practice, I might just do that. Thoughts?1.3KViews0likes4CommentsRe: Financial Troubles?
I'm using JScript. I know it doesn't support decimal types, and I've thought about switching languages, but I'm not as familiar with the other available options I looked at C# Script a bit, but it seems to have the same limitations as JScript (unless I'm missing something). Which one would you suggest? Also, I'm still hoping to salvage what I have for this project - I have about 2 weeks worth of development sunk into it using JScript, and I would hate to have to scrap it all and go back to the drawing board. Are there any possible workarounds?1.3KViews0likes0CommentsFinancial Troubles?
My system under test has a finance piece, and I'm running into trouble with the way TestComplete handles non-integers. As far as I can tell, my numerical options are to use integers or floats. The problem is, integers can't easily be used to handle decimal points and floats are inherently inaccurate. So occasionally, when I try to store 351148.87, it instead gets stored as 351148.866666667. This causes two problems. First, the initial checkpoints (verifying the expense was entered correctly) fail. Then later on, when I'm checking to make sure the expeses are all added correctly, I get a second failure because all of those small rounding errors start to add up. In my dataset of 200 expenses (totaling just over $1 million), I have a discrepancy of something like 36 cents. So, my question is, does anyone else out there have a similar problem? How do you deal with it?1.3KViews0likes7CommentsRe: Sporadic Namemapping Issues
I've seen the same issue a lot on my system. It seems that, for some reason, TestComplete occasionally loses the ability to see into open applications for a short time. But it is usually able to get it back, if you do a couple of things. I've been able to solve it by using a combination of things. First, you can use the General Open Applications property, specifically the Method Invoke Timeout property. I've also had success with the the WaitAliasChild method, and the Exists property, along with a RefreshMappingInfo call. It ends up looking like this: var w = Aliases.mySoftware.myForm.WaitAliasChild("myControl", 10000); if (!w.Exists) mySoftware.RefreshMappingInfo; Good luck!1.5KViews2likes2CommentsRe: Object does not exist.
I had a similar (or at least, similar-sounding) issue this week.. Next time it doesn't work, try looking in the Object browser and see what TC is recognizing the name as. In my case, TC was viewing the name incorrectly at random times (but especially when the program under test was closed and re-opened while TC was running), and therefore wasn't able to recognize the objects. And then, it would sometimes randomly recognize the object correctly again. The solution in my case was to increase the Method invoke timeout property in the Project Settings. Maybe that will help here, too? Edit: If Object Browser appears to recognize it correctly, it could still be the problem I linked to. I've seen TC re-name stuff in the Object Browser over the course of just a few seconds - it just takes time for it to realize that it's looking at an open application and get the proper names, I guess.2.4KViews1like0Comments