Ask a Question

Load new test value with each test run

New Contributor

Load new test value with each test run


Hi TestCompleters, simple question from a TC rookie here:


I've recorded a test in which an asset is created.

It is automatically given a unique ID number and also needs a description which can be anything, let's call it zzz000.

Now, when I re-run the test case my asset ID is automatically assigned a new unique ID number - but the description also needs to change otherwise my test crashes.


So: I've created an Excel sheet (CSV format) with a number of descriptions, zzz001, zzz002, zzz003 etc. and created a database variable whose value I have defined by this Excel file.

Now, sadly, I cannot make TestComplete move forward and use a new description every time I run this test?


Thank you and have a nice weekend!

Frequent Contributor

I don't mind helping you out, however I am confused as to what you are trying to achieve. Could you  go into more detail?

Esteemed Contributor

Question: Do the descriptions have to be specifically documented in the Excel spreadsheet?  Or, can you have your automation code, when it creates the new asset, generate a unique description at that time?


For example, in our application under test, we have to create a new record at the start of the test case.  The application creates a new unique ID automatically but, for tracking purposes, we need to generate a new description.  The record is for a person so we use a static last name of "LastName" for that data entry field.  The first name we use a code expression and generate the following in a "Set Variable Value" keyword operation:

'Test' + aqConvert.DateTimeToFormatStr(aqDateTime.Now(), '%Y%m%d%H%M')

Every time we run the test case, we always get a unique first name for the data record and assign it to that variable.  Then, everywhere through the test case we need to reference the person by name, we can use that variable.


Rather than having to read from an external file, I would recommend investigating this method.  It is less complicated than trying to make sure you always grab a new record from the Excel sheet each time you run the test.



Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Showing results for 
Search instead for 
Did you mean: