cancel
Showing results for 
Search instead for 
Did you mean: 

Add a scripting interface to the Data Generator

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:

 

https://community.smartbear.com/t5/TestComplete-Feature-Requests/Add-a-scripting-interface-to-the-Da...

 

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.

3 Comments
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. 

 

Example: 

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));
    Log.Message(table.Item(0,i))
  }
}
New 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.

 

I'm surely beating a dead horse at this point, but I would like to have a scripting interface that accesses the data generator functions to generate this data.  I think that it is such a great tool but it is limited to the wizard and that is unfortunate.  I can surely write my own script to generate data, but we pay good money for this software and it has a built in generator...I feel that letting us access those functions via scripting should be a given.

 

Thanks again for your reply.

Community Hero

Well, yeah, we all paid good money for TC, didn't we?  Smiley Happy

 

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.