Forum Discussion

a_g_reed's avatar
a_g_reed
Occasional Contributor
5 years ago

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

  • Wamboo's avatar
    Wamboo
    Community Hero

    "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 ;) :robotlol:

     

    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()

     

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      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.

       

       

      • a_g_reed's avatar
        a_g_reed
        Occasional Contributor

        Hi tristaanogre thanks so much for your reply and advice :smileyhappy:

         

        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

    • a_g_reed's avatar
      a_g_reed
      Occasional Contributor

      Hi Wamboo thanks so much for your reply it's very appreciated :smileyhappy:

      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 :robotlol: 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

      • Wamboo's avatar
        Wamboo
        Community Hero

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