SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 10 of 10
  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Setting Folder Name

    Hi guys,

    I am testing a backup softwrae and have recorded some steps of the software in VB script in Testcomplete7.

    I am wondering how to set the folder name, folder path. file name variables with VB script in Testcomplete.

    Some of the scripts goes like this:
    Set btnNext=dlgBackuptoDiskwizard.btnNext
    BtnNext.ClickButton
    dlgBackuptoDiskWizard.pageDialog.Edit.wText="Lisa"
    btnNext.ClickButton
    dlgBackuptoDiskWizard.pageDialog1.Edit.wText="C:\L isa"

    My question is how to change wText "Lisa" and the "Lisa"path to variables? so other user can pull up the scripts and preform the task? for example, other testers might want to backup a folder called "Michael" and set the path to "D" or "E" drive?

    Your help is appreciated! [img]/images/graemlins/grin.gif[/img]

  2. #2
    Member
    Join Date
    Apr 2009
    Location
    San Diego
    Posts
    413
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: PLEASE HELPPPPPPPPPPP!!!!!!!

    Dim strVar
    strVar = "Lisa"

    Dim varPath
    varPath = "c:\backup"

    dlgBackuptoDiskWizard.pageDialog.Edit.wText=strVar

    You can also use a Select Case statement based on the username variable.

    Select Case strVar
    Case "Lisa" varPath = "c:\backup\Lisa"
    End Select

    I don't use test complete so the syntax may vary a bit. Please consult the help files.

    Cheers~

  3. #3
    Junior Member
    Join Date
    Aug 2009
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: PLEASE HELPPPPPPPPPPP!!!!!!!

    Thanks Kisvacak,

    when i runned the script, the Testcomplete give me error message. Run-time error... any other ideas?

  4. #4
    Member
    Join Date
    Apr 2009
    Location
    San Diego
    Posts
    413
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: PLEASE HELPPPPPPPPPPP!!!!!!!

    Sorry, I am not familiar with that tool. I use QTP and the VB syntax is not strongly typed. Have you hit the help file yet? There should be code examples for setting variables as well as the syntax for a select case statement.

    Cheers~

  5. #5
    Member
    Join Date
    Dec 2005
    Location
    Texas, USA
    Posts
    30
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: PLEASE HELPPPPPPPPPPP!!!!!!!

    Try using global variables

    Project.Variables.AddVariable "BackupPath", "String"

    Project.Variables.BackupPath = "C:\Lisa"

    dlgBackuptoDiskWizard.pageDialog1.Edit.wText= Project.Variables.BackupPath


    I also add clean up code at the begining and end


    at the begining of my scripts I have the code

    If Project.Variables.VariableExists("BackupPath") Then
    Project.Variables.RemoveVariable "BackupPath"
    End If

    this is incase the script failed for some reason and left the variable in memory


    at the end of my scripts I have the code

    Project.Variables.RemoveVariable "BackupPath"


    hope this helps ?

  6. #6
    Junior Member
    Join Date
    Aug 2009
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: PLEASE HELPPPPPPPPPPP!!!!!!!

    Thanks so much for your help EMC TX! I have wrote the code based on your suggestions. (i forgot to mention about the folder name variable also). could you check the code please?
    they are as follows:

    Set dlgBackuptoDiskWizard = bkupExec.dlgBackuptoDiskWizard
    Set btnNext = dlgBackuptoDiskWizard.btnNext
    btnNext.ClickButton
    Project Variables.addVariable"BackupFolder","string"
    Project Variables BackupName=Lisa
    dlgBackuptoDiskWizard.pageDialog.Edit.wText = Project.Variables.Backupname
    btnNext.ClickButton
    Project.variables.addVariable"BackupPath", "string"
    Project.Variables.BackupPath="C:\Lisa"
    dlgBackuptoDiskWizard.pageDialog1.Edit.wText = Project.Variables.BackupPath

    btnNext.ClickButton
    Call btnNext.DblClick(55, 9)
    btnNext.ClickButton
    Call btnNext.DblClick
    (55,9)
    btnNext.ClickButton
    dlgBackuptoDiskWizard.btnFinish.ClickButton
    End Sub
    Project.Variables.RemoveVariable"BackupPath"

    Is this correct? I hope i put your script in the right place. and I am not sure about the folder name variables so i was just guessing...

    Thanks so much!

  7. #7
    Junior Member
    Join Date
    Aug 2009
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: PLEASE HELPPPPPPPPPPP!!!!!!!

    Its ok, no worries. yes i tried helpfile but no help.

  8. #8
    Advanced Member
    Join Date
    Jan 2006
    Posts
    995
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: PLEASE HELPPPPPPPPPPP!!!!!!!

    Using Titles like Please HELP or capitalizing to get attention can get you banned! Read the posting guidelines again!

  9. #9
    Senior Member
    Join Date
    Jul 2008
    Posts
    1,049
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: PLEASE HELPPPPPPPPPPP!!!!!!!

    Hi Lisalisa,

    If you still need assistance, please clarify the task you are trying to accomplish. How are the variables supposed to be passed to your code? Hard-coding the values as constants for further use is better than specifying the same string value in multiple places of your script, but you should probably try using the data-driven testing approach and specify some input parameters like local file/folder names in an external TXT/XML/CSV/XLS file. Please see the "Data-Driven Testing", "Working With Files From Scripts" and "Working With XML Files From Scripts" help topics for more information. If you use this approach, you will be able to run the same test with different input parameters without changing anything in your script.
    Regards,
    Allen - SmartBear Support

  10. #10
    Member
    Join Date
    Dec 2005
    Location
    Texas, USA
    Posts
    30
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: PLEASE HELPPPPPPPPPPP!!!!!!!

    Sorry, I've been out sick the past couple days .. did you get this working ?

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:50 AM.

Copyright BetaSoft Inc.