SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4

Thread: msgBox script

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    27
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    msgBox script

    How can i write a script in the qtp expert view in a way that one of two values are always taken when test is run. I tried using the one below but doesnt work:
    i=i+1
    msgBox("value i = "&i)
    j=i mod 2
    msgBox("value j = "&j)

    Kindly correct the script. Thanks

  2. #2
    Junior Member
    Join Date
    Apr 2009
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: msgBox script

    I don't quite understand what you're looking for. Do you only want one msgbox to come up? If so when would you want the first value and when would you want the second value to be displayed?

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

    Re: msgBox script

    Many thanks for yr response.

    I would like to automate a test and I would want one value after the other displayed. In my example I have 2 values which would be substituted one after the other, ie at the first run I want to tell qtp to use the first value of the 2 values, and at the second run use the second value. Third use first value, fourth run second value and so on.. How do I write a script that would tell qtp to carry out instruction.
    Kind rgds
    Durango

  4. #4
    Apprentice
    Join Date
    Apr 2009
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: msgBox script

    Hi Durango,

    You can use datatable to achieve this...

    Here is the sample code (you can replace msgbox with your statements):
    myobj = datatable("A",dtGlobaltable)
    If myobj mod 2 = 0 Then
    msgbox myobj & ": Even"
    else
    msgbox myobj & ": Odd"
    End If

    Before running the code, enter 1 to 10 in the Global datatable under column "A" (i.e., A1=1, A2=2, A3=3 and so on...

    Regards,
    K_Suresh_K | QTP Learner

 

 

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.71%
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 04:28 PM.

Copyright BetaSoft Inc.