Forum Discussion

hilary_davis's avatar
hilary_davis
Occasional Contributor
12 years ago

Randomized Data-Loop Testing - is it possible?

I am testing an online account openining functionality using TestComplete. This test has multiple scenarios, so I have numerous tests, which make up the project. Eventually the user will come to the webpage asking them to create a User ID. The User ID cannot already exist in our system. How can I create a data-loop test that will allow the varaible to be randomized each time?



Example:

Keyword Test 1 - Select Account Type

Keyword Test 2 - Bypass security

Keywork Test 3 - Select a User ID



The only way I see this functionality working is to record all actions within one test, but this is not possible for us, since there are hundreds of scenarios we need to cover within our testing - which has forced us to result in creating multiple keyword tests, then piecing them together within the project to deliver the results we want.

5 Replies

  • Hey, that's an interesting post, thank you for sharing your question. I'm sure members of the community would prefer posts to be kept within a single forum, rather than broadcast across forums, would you agree?

  • You could tack on a randomly generated number to the end of your user ID.



    In JScript:


    var min = 333333;



    var max = 999999;



    var randomNumber = Math.round(Math.random()*(max-min)+min);


  • NisHera's avatar
    NisHera
    Valued Contributor

    Is the question about creating random userID's 

    or hooking up different options for multiple test senarios?

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      I think they want the test top be re-usable.

       

      But part of the test is to create the user.

       

      And the same user cannot be created multiple times.

       

      I have a similar situation. Once my test has completed, I disable the user and the role set up for them. But at the same time I do this, I add some random strings of rubbish to the ID's stored for the user and the role. This way, they are not seen as duplicates next time round and the same user can be set up repeatedly so the input data for the test doesn't have to be constantly updated.

       

      But my application allows me to do it this way. If it didn't I'd have had to add the randomisation data at creation time.