cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie Question about Scripting Tests to run across multiple DB

SOLVED
Highlighted
Occasional Contributor

Newbie Question about Scripting Tests to run across multiple DB

Hi all,

 

For starters, I'll be frank - I'm a newbie to QA, newbie to automation, and have no tech background. I worked in hospitality for 12+ years and for the past ~3 years have been with a software dev company that develops Point of Sale (POS) software for use in hospitality. Until recently my main job duties mostly included end-user documentation and content production; occasionally I would assist with manual QA. We're now getting into automation testing with TC and I've been tasked with getting the ball rolling to figure out how we can use TC for our general regression tests.

I've learned a lot over the past couple of weeks from watching the TC tutorials in the SmartBear Academy, webinars, etc. It seems like my biggest weakness with trying to figure different things out is my lack of technical skills and understanding code.

Anyway, the issue that I've been stuck on for the past few days is how we can script tests that will run seamlessly across different test environments and different test databases. The reason being that obviously every customer in the real world will have a different setup in their POS; for example, Restaurant A might have a button for Coke in a certain position on one panel and Restaurant B might have it in a different position on a different panel. Another scenario could be that maybe we don't care which button is being selected as long as a product button is being selected and the product is rung up. Each product button has the same full class name (CFButton) so then TC maps them numerically and I've set up a template to use the TabIndex property to avoid conflicts. Even so, how can I script for TC to click any CFButton regardless of properties? I've looked into using Variables and couldn't work that at. I've also looked into the FindChild and FindAllChildren methods to see if maybe I could use that to return the objects (CFButtons) and go from there somehow. But, how can I actually see the objects being returned? Is there a different method that should be used?

I feel extremely lost on this; my next step will be to just start reading through more TC documentation page by page until things start to come together.

Thanks in advance for any replies or assistance.

- AGR

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: Newbie Question about Scripting Tests to run across multiple DB

Hi @a_g_reed,

 

I think you can watch several great learning courses. They will help you get started with TestComplete and scripting. Refer to the following resources:

https://academy.smartbear.com/store?utf8=%E2%9C%93&ss=1&ct=75086&commit=Filter

https://community.smartbear.com/t5/TestComplete-General-Discussions/Release-of-two-TestComplete-Work...

 
---------
Tanya Gorbunova
SmartBear Community Manager

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

13 REPLIES 13
Community Leader

Re: Newbie Question about Scripting Tests to run across multiple DB

"Restaurant A might have a button for Coke in a certain position on one panel and Restaurant B might have it in a different position on a different panel"

 

The coordinates on the screen do not matter if you map objects to the NameMapping repository.
The case you are describing indicates that one program will run with other presentation layers so what you can do is add another configuration to the NameMapping repository or if the changes to the presentation layer are on a larger scale then create a new project with a detachable NameMapping and add files there as a reference.

 

Another scenario could be that maybe we don't care which button is being selected as long as a product button is being selected and the product is rung up. Each product button has the same full class name (CFButton) so then TC maps them numerically and I've set up a template to use the TabIndex property to avoid conflicts. Even so, how can I script for TC to click any CFButton regardless of properties?

 

Button class name can be common for each button because it can be inherited in the program structure.
Find a different property but unique for the object.
In "Object Spy" develop advanced options for the object and look for something like "Object identifier".
Check what the project you want to automate and identify if TestComplete natively supports these components e.g. VCL Borland, WPF etc.
You can use TestComplete as a dynamic search engine. It requires you to write the function in any of your chosen progrma language supported by TestComplete.

 

I've looked into using Variables and couldn't work that at. I've also looked into the FindChild and FindAllChildren methods to see if maybe I could use that to return the objects (CFButtons) and go from there somehow. But, how can I actually see the objects being returned? Is there a different method that should be used?

 

In, out 😉 Robot LOL

 

learn the basics of the chosen programming language and use the basics of variables in it, e.g. in JavaScript.

 

var variable = Aliases.obj

 

Aliases.obj is a class that goes back to the NameMapping repository and extracts values from it.
If you want to see what you're currently jammed into a variable, use a debugger. Search the documentation for information about the debugger.
There are a lot of methods to search for active objects on the screen and to look for those after the active process structure. One of them is for example .find()

 

Highlighted
Community Hero

Re: Newbie Question about Scripting Tests to run across multiple DB

Hi, 

 

I used to work for a software company that did POS for amusements and attractions.  So, I've had to answer some of your same questions.  A couple of pointers:

 

1) Don't get caught up in having to have a configuration for each of your clients and run tests for each.  You're not testing their setups, you're testing your software.  So, create scenarios, products, etc., within the software in your testing lab that simulate different possibilities.  Focus most of your attention on the more commmon setups and then, as time allows, start adding in more complicated configurations.  The end result is that you'll be testing all your clients' setups without having to worry about reproducing them.

2) As @Wamboo suggests, learn a programming language and start taking advantage of it.

3) When it comes to object identification, again, as @Wamboo said, start looking for properties that make an object unique.  It may not be one singular property, but a combination.

 

 


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Occasional Contributor

Re: Newbie Question about Scripting Tests to run across multiple DB

Hi @Wamboo thanks so much for your reply it's very appreciated Smiley Happy

I have gotten familiar with NameMapping over the past few weeks but it sounds like I have a bit more to research and learn there.

Just as you've described, I did use the Object Spy and went through each property of the object in question to determine which is a unique identifier and from what I can tell, the only one that is (aside from coordinates or other location markers) is TabIndex so I've used that to map the buttons.

It looks like my next step is going to be finding some tutorials and learning a bit about our programming language which I was just told is vb.net. Maybe I should've started there before diving into test automation Robot LOL I've seen a little bit somewhere about using a debugger and I wasn't quite grasping the concept; so, I'll definitely follow your recommendation to read up on that as well.

 

Thanks again for the advice!

 

- Allen

Highlighted
Occasional Contributor

Re: Newbie Question about Scripting Tests to run across multiple DB

Hi @tristaanogre thanks so much for your reply and advice Smiley Happy

 

I didn't think I'd find someone in the SmartBear Community with POS knowledge so quickly! Believe me, I had no intention of having a configuration for each of our clients lol and was planning on doing as you've suggested - more common setups and adding as we go (great minds think alike). My first real challenge came when I tried to get a script to run across just 2 different QA databases and was faced with this object property conflict. As mentioned in my reply to @Wamboo I was able to determine that the TabIndex property seems to be the only unique property from one button to the next (although there will still be differences here from DB to DB so I'm not too sure that's a viable solution for our situation). It looks like I'll be spending some time today and maybe the next few days learning some basics of our programming language. Hopefully, that will clear some things up for me and maybe I'll be able to attack this from a different angle.

 

Thanks again for your time and advice!

 

- Allen

Highlighted
Community Leader

Re: Newbie Question about Scripting Tests to run across multiple DB

I'm glad I could help. If you need more help, go ahead.

Highlighted
New Member

Re: Newbie Question about Scripting Tests to run across multiple DB


@kroger feedback wrote:

I'm glad I could help. If you need more help, go ahead.


Just as you've described, I did use the Object Spy and went through each property of the object in question to determine which is a unique identifier and from what I can tell, the only one that is (aside from coordinates or other location markers) is TabIndex so I've used that to map the buttons.

Highlighted
Community Leader

Re: Newbie Question about Scripting Tests to run across multiple DB

You may also consider using this solution:

 

 

https://support.smartbear.com/testcomplete/docs/working-with/managing-projects/properties/open-apps/...

 

When the situation is critical and you really don't have any uniq Id to map, then you can try searching for text on screen.

Highlighted
Community Hero

Re: Newbie Question about Scripting Tests to run across multiple DB

Hi,

 

> is TabIndex so I've used that to map the buttons.

TabIndex sounds not that reliable to me...

You difinitely may talk with developers and wonder how stable the value of TabIndex for the given button will be. You are lucky if it is and may proceed with this approach.

If it cannot be guaranteed that the value of TabIndex will remain stable, you may consider the approach like this:

-- Search for all buttons within required scope (window/panel/etc.) using the .FindAllChildren() method;

-- Iterate through the returned array and look for the button you need using some other criterion (for example - its caption);

-- Proceed with the found button.

 

The above approach will work even if TabIndex value changes from run to run. The price that you will pay is decreased performance (because of searching for all buttons and additional filtering) and possible cases with localization (if your application has localizations).

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Occasional Contributor

Re: Newbie Question about Scripting Tests to run across multiple DB


@AlexKaras 
If it cannot be guaranteed that the value of TabIndex will remain stable, you may consider the approach like this:

-- Search for all buttons within required scope (window/panel/etc.) using the .FindAllChildren() method;

-- Iterate through the returned array and look for the button you need using some other criterion (for example - its caption);

-- Proceed with the found button.

 

The above approach will work even if TabIndex value changes from run to run. The price that you will pay is decreased performance (because of searching for all buttons and additional filtering) and possible cases with localization (if your application has localizations).

 


Thank you very much for your reply and information Robot Happy

Yes, I'm also worried about the TabIndex being stable, but it was the only unique property of the object so I figured I would try with that and see where it took me. I think it would work fine if all tests were being run on the one DB, but I'm almost certain it won't be useful across multiple DBs.

I had actually thought about and looked into using the FindAllChildren method. However, where I was getting stuck was with actually returning an array. I wasn't sure which PropName and PropValue to use with the method in order to have anything returned. My first few attempts resulted in blank returns. Do you have any recommendations? Also, how would I go about iterating through the returned array? I really think this will be the way to go, because like you said it will work even if TabIndex changes from run to run. I'm not too concerned about decreased performance because this might be the only option for us to use TestComplete for this particular app (at least across multiple DBs).

 

Thanks again for the info,

- Allen

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!

Retrieve Data from a Web Page

Participate!
Top Kudoed Authors