ryanterronez's avatar
Occasional Contributor
6 years ago
New Idea

Add a scripting interface to the Data Generator

I would like to be able to run a script at the beginning of my tests that will update all the column values in a table variable using the data generator.  This automation would be an incredibly valuable tool.  I have seen a similar post here:




The answer given does not address the issue at all.  What we want to do is build a script that will give us fresh data each time we run a test.  If we have to use the data generator wizard interface every time we run a test, then we cannot truly automate testing.


  • cunderw's avatar
    Community Hero

    Like the previous post mentioned, it's very possibly to script this already. You can edit variables at run time, including the table variable created by the Data Generator. You just need to create script code that generates the random data based off of your criteria. 



    function test() {
      let table = Project.Variables.Var1;
      for(let i = 0; i < table.RowCount; i++) {
        table.$set("Item", 0, i, Math.round(Math.random() * (10 - 1) + 0));
  • ryanterronez's avatar
    Occasional Contributor

    Thank you very much for your prompt response.  I have found many posts that show funtctions to generate random data.  I will probably end up using a function like the one you provided.


    Thanks again for your reply.

  • Marsha_R's avatar
    Champion Level 3

    Well, yeah, we all paid good money for TC, didn't we?  :smileyhappy:


    We also all have different applications for TC and different new features we would love to have.  What's a "given" for me, isn't necessarily one for cunderw or tristaanogre and vice versa.  TC is a great overall tool, but it's going to miss some things occasionally.  


    Over the years, SmartBear has been pretty good about adding features where the need is shown or, when that's not currently possible, helping to find a good workaround.  Either way, the staff and community are more than willing to help get your tests going.