SPONSORS:






User Tag List

Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Feb 2001
    Location
    New York, NY
    Posts
    41
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    User input during runtime

    Can anybody tell be what is the best way to get user input during runtime?
    Something like Agent.DisplayMessage (sTitle, sMessage), but only with option to enter data.



    Here is my test case:

    1. A tester must run a complicated manual process. This generates a process ID on the screen.

    2. Then tester must start Silk script.

    3. The script should ask for the process ID, because the database table where results are stored can be big.



    Thanks

    ------------------

  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: User input during runtime

    It's quite easy to invoke notepad and to read text files; you can use those as a way of getting info into the script mid-run.

    ------------------

  3. #3
    Member
    Join Date
    Feb 2001
    Location
    New York, NY
    Posts
    41
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: User input during runtime

    Here is a lame response from Segue

    Basically, in Silk 5.5, there is no easy way to do it

    <FONT FACE="Garamond" SIZE=2>

    QUESTION

    ----------------------------------
    Is there a way to allow user input from a running SilkTest test script?
    Scenario:
    You might want to pause a script at a known location and prompt the user for input required to continue the test (for example, a configuration parameter or some piece of text unknown to the script beforehand). The challenge then becomes how to get the missing information and/or data into the test script while it is running.
    ANSWER

    ----------------------------------
    Use Agent.DisplayMessage () in conjunction with your favorite text editor.
    Instructions:
    1. Create a script that drives your application to a known state.

    2. Invoke your favorite text editor (such as WordPad with Win95, or Notepad with Win3.1)

    3. Send the command Agent.DisplayMessage () with instructions on what type of text to enter into the text editor. Remind the user to hit OK on the MessageBox brought up by this call once he or she has completed the specified task.

    4. Use GetText () if QualityWorks/SilkTest sees the Editor window as a TextField. Another alternative is to drive the script to select the text in the Text editor, copy it to the Clipboard, and then use Clipboard.GetText to retrieve the information from the Clipboard.

    5. Shut down the text editor.

    6. Utilize the information retrieved from the Text Editor in the rest of your script.

    7. The script will run against the test application that is shipped with QualityWorks/SilkTest.
    The code:
    main ()

    GetInputAndProcess ()
    testcase GetInputAndProcess ()

    TestApplication.SetActive ()

    TestApplication.Control.ListBox.Pick ()

    STRING sInput = GetInput ()

    xListBox.SetActive ()

    xListBox.TextItem.SetText (sInput)

    xListBox.AddItem.Click ()

    ListPrint (xListBox.TheListBox.GetContents ())
    STRING GetInput ()

    STRING sTmp

    WordPad.Invoke () // or your favorite editor

    Netscape.SetActive () // see Note for explanation

    Agent.DisplayMessage ("Input from user",

    "Please enter some text into WordPad and hit OK to continue")

    WordPad.SetActive ()

    sTmp = WordPad.TextField1.GetText ()

    WordPad.File.Exit.Pick ()

    if (MessageBox.Exists ())

    MessageBox.No.Click ()

    return (sTmp)
    What you should see when you run the script:
    You should see the ListBox DialogBox invoked from the Test Application.

    Next, QualityWorks/SilkTest invokes WordPad. A MessageBox pops up asking you to enter input into WordPad and then click OK. Once you hit OK, the information from WordPad is used to manipulate the ListBox DialogBox and the script passes.
    Important Notes:
    You should make sure to set another application (other than WordPad) active before calling Agent.DisplayMessage (). The reason is that Agent.Display- Message () invokes an application modal MessageBox parented to the active application. If WordPad were the last active application, you wouldn't be able to enter any text into it. This would then defeat the purpose of the exercise.
    Preferred methods of starting any editor application"
    1) Declared

    - Record the declarations for the editor application.

    - Create command line parameters (see example below)

    - Open via Editor.Invoke ()'
    [ ] //Example: WordPad

    [-] window MainWin WordPad

    [ ] tag "*WordPad"

    [ ] // The working directory of the application when it is invoked

    [ ] const sDir = "C:\Program Files\Windows NT\Accessories"

    [ ]

    [ ] // The command line used to invoke the application

    [ ] const sCmdLine = "C:\Program Files\Windows NT\Accessories\WORDPAD.EXE"
    2) Dynamic Instantiation

    - Note: You would also need to use Dynamic Instantiation to use get the text and to close the application.
    MainWin("").Start("C:\Program Files\Windows NT\Accessories\WORDPAD.EXE ")
    IMPORTANT: It is not advisable to use 'SYS_Execute ("wordpad.exe") to invoke the editor application as this function runs the application in background mode (and on NT it is not displayed). Any application run with this function that requires input will be paused until the app is manually closed.</P>
    </FONT>

    ------------------

  4. #4
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: User input during runtime

    The brute force way is to use win32api but it could mean writting a .dll

    You can also do similar stuff using pre-created web pages and grab the data from your browser. It might sound ugly but you are using silk, and it's ugly To make it look good you can try some fancy styling to your browser, that's left as an excercise for the reader(hint re-format your page-size,style in a function- load the format on load of the page):P

    Use GetText() as suggested before to grab the data.

    I hope you see the pictures.

    ------------------
    Better write your html page within your script and load it. Since you can use javascript you can have some real nice stuff hapenning.

    [This message has been edited by GodKnows (edited 07-05-2001).]

  5. #5
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: User input during runtime

    You can also load the data by launching your SilkTest script from a command line and including the information you get manually (ID) as a parameter to the the command line. You will need to change your script so that it is launchable from the command line.

    I created a simple Access front-end for my applications that allow the user to input their username and password and then launch the SilkTest script that they want to run. This may be what you are looking for.

    The shell command looks like the following:sShell = "D:\APPS\silk\partner.exe -q -r " 'Location of the Silktest exe, close when finished, run
    sShell = sShell & "d:\apps\Silk\ANew\ANew.t " 'Location of the SilkTest .t file
    sShell = sShell & sUsername & " " 'IE Username value (for proxy)
    sShell = sShell & sPassword & " " 'IE Password value (for proxy)

    Hope this helps,
    Mike


    ------------------


    [This message has been edited by MikeF (edited 07-09-2001).]

  6. #6
    rg
    rg is offline
    Member
    Join Date
    Feb 2000
    Posts
    98
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: User input during runtime

    Try this using JavaScript. Keep in mind that there are a lot of sites that cause the Javascript errors in IE so you may have trouble with it:

    BrowserPage.ExecLine ('alert (prompt("Testing", "123"))')

    This pops up a dialog box with the value that was input. You can then have SilkTest read the value from this box and then dismiss the box.

    ------------------

  7. #7
    Member
    Join Date
    Aug 2000
    Location
    Hyderabad,AP,India
    Posts
    80
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: User input during runtime

    Hi rg,

    Is this method 'ExecLine' only with Silk test 5.5. No way for users of Silk Test 5.0.3



    Baseer

  8. #8
    Member
    Join Date
    Feb 2001
    Location
    New York, NY
    Posts
    41
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: User input during runtime

    Thanks all for your comments,
    all work arounds that were presented here are OK, but require more maintains than I want to do for such little return. I was hoping for inputbox function, that Silk unfortunatly does not have.
    So what I did in mean time, is to make input a global variable by placing it on the top of my script and before I use it in the testcase, I added the following code:

    STRING sTitle = "Value Verification Message"

    STRING sMessage = "The {value} will be used. Press OK to continue, or Cancel to halt execution and enter the correct one. It can be found on top of the script."

    Agent.DisplayMessage (sTitle, sMessage)

    I thought this is more strait forward approach.
    -Lev


    ------------------


    [This message has been edited by levaks (edited 07-19-2001).]

  9. #9
    Senior Member
    Join Date
    Jul 2001
    Location
    Elizabeth, CO, USA
    Posts
    653
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: User input during runtime

    Prompting for input with a SilkTest generated HTML page isn't hard, either.

    The attached .zip contains a .inc file that'll do a simple one item prompt. Fairly easy to modify that to prompt for more things as necessary.

    Just use the PromptForInput function. Unfortunately, if you're testing a web application, this might muck things up by switching to the prompt page.

    - Dave



    ------------------
    Amelior Technology
    dreed@ameliortech.com
    WaltzingRhino.com
    A concerned Borland customer, a fly in the ointment, a wrench in the works.

  10. #10
    Mel
    Mel is offline
    Junior Member
    Join Date
    Mar 2001
    Location
    San Jose, CA, USA
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: User input during runtime

    Hi Dave,

    Regarding the solution you've proposed here for prompting the user/tester, I've tried it, and I like it very much.

    I'm testing a java standalone application. The only one little problem: when the test runs, it always gives a warning:

    *** Warning: wMainWindow should be of class BrowserChild

    My main window is my JavaMainWin, and not the browser. Do you have any suggestion on how to prevent this warning??

    Thanks.




    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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:10 PM.

Copyright BetaSoft Inc.