Forum Discussion
NisHera,
Thank you for responding, and offering your thoughts. I'm not creating a data driven test however. I'm creating a single run (if it passes, of course) regression test of our Create Contact function.
As all contacts are unique (I can not create duplicates) - I need to create a new one each time I run the script.
I'm finding it very odd that TestComplete has a data generator option that will create a single random email and a single random name one time - when creating a random each time a script is run is much more useful.
Right now it seems my best option is:
A - Use the data generator to build a large file - Save it to a table or excel.
B - Then - Every time I want to run the script - Update the entries in the script.
C - Delete those entries I'm about to use from the file.
D - Run the test.
That's a lot of manual manipulation to remember - even with comments.
I'm wondering if it is possible to create a data driven script - that will run once - and will delete the last entry from its source file?
That might get around this restriction.
Rich
What we've done to create new, "randomized" contacts is to not bother with randomization.
I'm working with a healthcare application in which, each time through the test run, I need to add a new "patient"... but the patient has to have a unique SS # that does not equal the SS# for any other patients in the system... so, yes... need a new SS# each time I run the test. Not data driven, but I just need unique data.
Solution: I create my own SS# by concatenating the Julian date (today is 187), the two digit year (17) and the 4 digit 24 hour time of day (1335). This creates a unique 9 digit number that changes each time I create a new patient.
Perhaps, when creating contacts and their e-mails, you can utilize a similar methodology. Rather than having to create a table that contains the values, just build into your automation code/keyword test something that generates these unique numeric values that you just append onto a default name. Like, using the above, you could have a contact named "TEST 187171335". And their e-mail address could be "TEST187171334@x.com". If need be, you can add the seconds onto that time if your tests take less than a minute, that would add another factor in creating a unique ID.
- Marsha_R7 years agoChampion Level 3
We do something similar to what tristaanogre does. We have a variable called idstring that is a combination of date, hour, minute, second and if I need a random string for any field then I use eval(idstring) to get it.
- tristaanogre7 years agoEsteemed Contributor
DOH! Now why didn't I think of that, Marsha_R.
So... now I'm going to go back to my project, create a property in my framework script extension for that SS# and have it just simply return that unique ID. I've been doing the dumb thing and creating the string each time rather than from a centralized point... I feel sheepish. :)
I'll probably also add another property that will return a more lengthy unique ID for other use similar to what you've done. Thanks for the inspiration!
- Marsha_R7 years agoChampion Level 3
I'm just lazy. I got tired of cutting and pasting it for every place I needed a number. :)
Related Content
- 2 years agovericomms
- 11 months agoTauras
- 11 months agosinis
- 3 years agogeneticmaterial
Recent Discussions
- 4 hours agojstaehlin
- 22 hours agoAivanitskiy