Results 1 to 6 of 6
  1. #1

    setting unique values in QTP

    Hi All, This a great forum... you guys are all rocking... I need help from you guys on one issue I am having.

    I created a script which creates s user accounts in a website by filling up a form. The script needs to create unique username (testaccount_&a&amp every time I run it. For this I used this solution. Creating a txt file with value 1 in it and reading from QTP and after using it increment by 1 and write it back to txt file which makes the file to carry 2. So next time when I run my script again I am creating a new account with unique username(testaccount_2). Now I am having a prolem if I load the same script in QC and try to run it from a different system, then I wont be having my updated txt file, ultimately makes my script to fail. Is there any way I can save the txt file in QC and make my script work all the time from any system. Or is there any way to solve my script with out this much pain... May be by using datatables or something else...

    I know its a long explanation... Sorry I am a newbie. Hope to hear from you guys soon.... Thanks a lot in advance
    - Czar [img]/images/graemlins/smile.gif[/img]

  2. #2

    Re: setting unique values in QTP

    yes, there is a way using OTA for QualityCenter. look through this forum for "attach file to QC" or anything like this (i think there are some example functions in one of the sticky posts).
    you can download. change and upload a txt-file of course.

    but i would see any problems if you will run the script at same time on different machines....

    de omnibus dubitandum

    For all Questions: Please be sure to take a look at the QTP Manual before posting any Questions, thanks for doing this

  3. #3

    Re: setting unique values in QTP

    Better you use RandomVal=Replace(Replace(Replace(now," ",""),"/",""),":","") function to remove duplication..


    You must have to open this .txt file from server and update there.

  4. #4

    Re: setting unique values in QTP

    Hi Thanks for your response. I am these possibilities you mentioned. I will try them and let you know the results. In the mean while I used another method using datatables... but I am having some problem.... here is the simple code I used

    Dim a
    ' I gave value 1 in the global sheet, so above statement 'assigns 1 to a
    'which assigns 2 back to coloumn A, which makes it 2.

    Its working fine but surprisingly after the script Run is over the datasheet is set back to 1. Is there any way to prevent it to set back to original value. This definetly make my life easy.

    - Czar [img]/images/graemlins/smile.gif[/img]

  5. #5
    Advanced Member
    Join Date
    Mar 2007
    Salt Lake City, UT, USA

    Re: setting unique values in QTP

    Any changes you make to the run-time DataTable only last while the current test is running. When the test ends, those changes go away.

    One solution is to export the DataTable at the end of the test run, then import it at the start of the test run. This will save your changes permanently as an .xls file so they will be available after the import on your next run.

    Of course, this takes you back to your original problem of storing files where QC can get them, so the solution to your original question in this thread is necessary for this solution to work.
    "The last 10% of any software project will take 90% of the budgeted time. The first 90% will take the other 90%"

  6. #6

    Re: setting unique values in QTP

    can you tell me how I can export and import a datatable or tell me where I can find the info about this. thanks a lot in advance
    - Czar [img]/images/graemlins/smile.gif[/img]



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 05:56 PM.

Copyright BetaSoft Inc.