SPONSORS:






User Tag List

Results 1 to 4 of 4

Thread: Error Handling

  1. #1
    Junior Member
    Join Date
    Nov 2000
    Location
    Coventry, RI USA
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error Handling

    I am new to Silk test and have been writing in recording scripts with it over the last two weeks. I have a question about error handling. I am testing a web application. And breaking each test out and then combining them in to one big test plan. The problem that I have is when one test case fails. The whole test plan ends. I have been play with the do...except statement. But haven't gotten it right yet. What I want to do is. If a verification fails. Return to the main page to start the next test.

    I have attached my code for this. Hopefully it is readable. And thanks in advance

    ] // Then verify these links in that index (ActivityClassifier,ClassDiagram (cad),ComponentDiagram (cpd)
    [-] do
    [-] NtscpIndex.IndexDispNetscape.VerifyProperties ({...})
    [ ]
    [ ] ""
    [ ] {}
    [-] {...}
    [-] {"Reload", {...}}
    [ ] {"Caption", "Reload"}
    [-] {'HtmlText ("test|#1")', {...}}
    [ ] {"Text", "test Cool jex"}
    [-] {'HtmlLink ("ActivityClassifier:ActivityDiagram (ad)*")', {...}}
    [ ] {"$Caption", "ActivityClassifier:ActivityDiagram (ad)"}
    [-] {'HtmlLink ("ClassDiagram (cad) Classifier1:ATestDiagram (etd) Classifier1 iagram1 (ad)*")', {...}}
    [ ] {"$Caption", "ClassDiagram (cad) Classifier1:ATestDiagram (etd) Classifier1 iagram1 (ad)"}
    [-] {'HtmlLink ("ComponentDiagram (cpd) DeploymentDiagram1 (dpd) MEPClassifier1:MEPDiagram1 (etd)*")', {...}}
    [ ] {"$Caption", "ComponentDiagram (cpd) DeploymentDiagram1 (dpd) MEPClassifier1:MEPDiagram1 (etd)"}
    [-] except
    [ ] Explorer5.SetActive ()
    [ ] Explorer5.Close ()
    [ ] BrowserPage.SetActive ()
    [ ] MesaVista.MesaMenu.ProjImg.Click ()
    [ ] Print ("Verification Failed")
    [-] // Verify that the digram matches the Bitmap called Cooljex.bmp located on MESATEST1 in c:\\Silk BitMaps\CoolJex.bmp
    [+] MesaVista.SetActive ()
    [ ] NtscpIndex.IndexDispNetscape.SetActive ()
    [ ] NtscpIndex.IndexDispNetscape.HtmlLink("ActivityCla ssifier:ActivityDiagram (ad)*").Click ()
    [ ] MesaVista.VistaWindow.VerifyBitmap ("\\MESATEST1\Silk BitMaps\CoolJex.bmp", {1,62,676,371})
    [-] // Click the Mesa vista back button twice to get you to the project folder
    [+] MesaVista.SetActive ()
    [ ] MesaVista.VistaWindow.HtmlImage("javascript:histor y.back();|#1|$javascript:history.back();").Click ()
    [ ] MesaVista.VistaWindow.HtmlImage("javascript:histor y.back();|#1|$javascript:history.back();").Click ()
    [-] // Set active the "test Cool jex" index. And then close it.
    [+] Explorer5.VerifyProperties ({...})
    [ ]
    [ ] ""
    [-] {...}
    [ ] {"Enabled", TRUE}
    [+] Explorer5.SetActive ()
    [ ] Explorer5.Maximize ()
    [ ] Explorer5.Close ()
    [ ]

    [This message has been edited by ksull10 (edited 11-14-2000).]

  2. #2
    Senior Member
    Join Date
    Jul 1999
    Location
    Burlingame CA 94010
    Posts
    502
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error Handling

    It sounds like you're using appstate none. To enable the SilkTest recovery system for testing a web application, you need the following.

    1) wMainWindow set to a BrowserChild
    2) sLocation data member set within that BrowserChild to a valid URL
    3) testcases which use DefaultBaseState or another appstate basedon DefaultBaseState.

    Hope this helps.


    ------------------
    John W Green
    jwgreen@automationexpertise.com
    http://www.automationexpertise.com

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

    Re: Error Handling

    If you do not want to use SILKTest's error handling function, turn your testcases into functions with a do..except in each. This allows you to direct the test to the proper location. This gives you a lot more flexibility in dealing with errors.

    To turn existing testcases in functions delete the word testcase from the front of the testcase and the appstate information from the end of the testcase name.

    Example:
    [-] VerifyScreen1 ()
    [-] do
    [ ] Browser.Invoke ()
    [ ] BrowserAuthentication.UserName.SetText (USERNAME)
    [ ] BrowserAuthentication.Password.SetText (PASSWORD)
    [ ] BrowserAuthentication.OK.Click ()
    [ ] Browser.Location.LoadPage(sURL)

    Insert your code here

    [-] except
    [ ] sDateTime = "DateTime: {GetDateTime()}"
    [ ] sExceptData = (ExceptData())
    [ ] ExceptPrint()
    [ ] Browser.SetActive()
    [ ] Browser.Close()


    The code within the do statement sets the browser to the location you want to start at, this way each testcase function is not dependent on the one before. The browser close command in the except statement closes the browser so that you can start with a new browser for your next testcase function.


    [This message has been edited by MikeF (edited 11-17-2000).]

  4. #4
    Senior Member
    Join Date
    Jun 2000
    Location
    Chicago, IL USA
    Posts
    383
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error Handling


    What I find most powerful about SilkTest's do ... except construct is that I can choose how I want to handle different types of errors. If the error is in a Verify() function, I put ExceptLog() in the except clause and the error just gets logged and the test continues.
    If the error is an unrecognized navigational control, then the rest of the testcase is probably not valid and I let the exception stop the testcase and begin the next testcase. Each testcase then has an appstate to reset everything.
    Sometimes I even put code in the except clause that waits a little and tries the control a second time.

    I have discovered one REALLY nice feature that is not discussed in the Segue documentation.
    If you wrap your Verify with do .. except and ExceptLog(), then when there is a validation error,
    there is a menu item that become available in the results viewer labeled "Results"->"Update Expected Value".
    This is a fantastic timesaver. You can view the "Actual" and "Expected" results side-by-side, and if the difference is a valid update, "Update Expected Value" instantly replaces the data in your test!
    Rob Kapteyn, CSTE
    RobKapteyn@gmail.com

 

 

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 07:43 PM.

Copyright BetaSoft Inc.