Forum Discussion

progz's avatar
progz
Occasional Contributor
8 years ago

How do I loop an entire test within Test Complete?

Hello everyone,

 

I was working with Test Complete, and was having some trouble on learning how to loop an entire 'test' within the application. It seem as if you can loop data, and certain parts within the test, but is there a way to loop an entire test?

 

Thank you

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The short answer is, yes, you can loop a whole test.  I'm assuming you're working with Keyword tests so, generally, you just select all the test steps within your test, right click, and then select either Make Data Loop or Make Browser Loop depending upon what you are trying to do.  That's the easiest way to explain it. 

    Now, you can also do your standard code loops like "for" loops and "while" loops, but I'm assuming that you're more concerned with looping with a set of parameters of some sort and that's what those two loop modes will do for you.

  • cunderw's avatar
    cunderw
    Community Hero

    You can specify the number of times a test item can be ran on the project test items page, you can do a for loop for your entire KWT, etc..

     

    If you provide more information on exactly what you would like to accomplish we can help!

    • progz's avatar
      progz
      Occasional Contributor

       


      cunderw wrote:

      You can specify the number of times a test item can be ran on the project test items page, you can do a for loop for your entire KWT, etc..

       

      If you provide more information on exactly what you would like to accomplish we can help!


       

      So I am basically working with a POS software and just want to repeat a transaction. Looping a test within an entire project would be perfect. How exactly would I loop a 'test' part of my project? I hope this makes sense.

       

      This image: http://imgur.com/a/77kVA shows what I am talking about.

       

      Thanks for the quick responses!

       

      Edit: Also, I hope I am not confusing anyone. I think I understand what loop means, but I mean to just repeat all my steps in general.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Gotcha.

        So, if you double click on your project (what is labeled about "Tan female blah blah blah") you should have a tab in your right hand side of the screen for Test Items (I'm taking you the long way around because, looking at the icon on your project, you're running an older version of TestComplete so I'm not sure of the new bells and whistles).  Add a new test item, link your test to that, and there should then be a "Count" column for the test item... simply set that number to the number you want and voila!  Your test item will execute that many times.  

         

        Edit: progz, just one note... by doing what I described, you will get EXACTLY the same test the number of times you set the Count value to.  Pretty much, a "dumb" loop that will run through and just playback all the steps with no variation. If after one time through the loop the application state changes so that things are shifted or moved or values are different, then your test could break on hitting the second iteration.

        However, repeating a test like that really only adds value as a data entry process and isn't really "testing" anything. So, if you want to go through the test multiple times, each time changing some values and such for the purpose of seeing whether or not the transaction engine handles multiple scenarios (different quantities of product, different forms of payment, different products, etc), then you're going to want to do something like like data driven loop and set up some parameters in your test for those variations.