Forum Discussion

yaseenmd's avatar
yaseenmd
Contributor
9 years ago

Run Time Test Data for TestScript

I am using TestComplete to automate the desktop application. i have done recording. Issue is test script hold the value as hard coded. but i want to pass the values in run time. how can i do it?

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Are you recording a script or a keyword test?  When doing it via script, do as baxatob mentioned and turn your recorded test into a function where you pass in either a set of parameters or a variable. A good topic on this would bet https://support.smartbear.com/viewarticle/70805/.  This topic covers manually making the changes which works for both Script and Keyword tests.

       

      If you recorded a keyword test, if you select all the parts of the test that you want to change hardcoded values to parameters, when you right click on that set, you'll have an option to "make a data loop". Check out https://support.smartbear.com/viewarticle/71513/ for more information on that.

       

      Generally speaking, no matter what you decide as your means, the general idea is that you'll replace your hardcoded values with variables of some sort that you'll either pass in as parameters to your test or gather from some data source and execute in a loop.

    • altemann's avatar
      altemann
      Contributor

      Hey yaseenmd  , how's going? What do you mean with "i want to pass the values in run time"? If you meant passing the values during the execution of your tests, this would be the way to do this:

       

      function Test()
      {
        var yourInput = BuiltIn.InputBox("Input box", "Input your text:", "");
        //do whatever you want with yourInput...   
      }

      Help for Input Box: https://support.smartbear.com/viewarticle/74068/