Forum Discussion

prusilusken's avatar
New Contributor
7 years ago

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!

2 Replies

  • Novari-QA's avatar
    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?

  • tristaanogre's avatar
    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.