SPONSORS:






User Tag List

Results 1 to 5 of 5

Thread: Error Handle

  1. #1
    Junior Member
    Join Date
    Jan 2002
    Location
    Wichita,KS
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error Handle

    What is the best way to control errors when testing a series of testcases so that tester can choose either run all testcases with errors occur or stop some of the dependent testcases when errors occur? When I use do except, how to make sure the errores execption mesaages in result file are correct, not repeat from coeds inside the except?

    Lias

  2. #2
    Junior Member
    Join Date
    Jan 2002
    Location
    Denver, CO
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error Handle

    My best advice is to be very careful when using do...except. It can cause more problems than it solves. When an exception happens that stops the testcase, it is usually a result of one of these three conditions:
    1. A window or control is not found.
    2. A variable is not set.
    3. A variable does not exist (this one is pretty rare)

    In all three cases, you have a pretty serious problem with your script. The script should be fixed first so that these errors never happen in the first place. Of course, there are always some situations where you might want to continue the script, and then do...except comes in handy.

    If you provide some more specific details about your problem, I might be able to give you a better answer.

    ------------------
    Paul Fountain
    QA Analyst/Engineer
    Sungard Insurance Systems
    Paul Fountain
    QA Analyst/Engineer
    Sungard Insurance Systems

  3. #3
    Junior Member
    Join Date
    Jan 2002
    Location
    Wichita,KS
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error Handle

    We are trying to verify the functionalities of application's windows as following.

    1. If one of the function (like VerifyWINDOW1Toolbars() )failed, we can still choose to test the next function (like VerifyWINDOW1Menu() ) or not.

    2. If any toolbar button is not enabled, the VerifyWINDOW1Toolbars() failed.

    The problem is that in function VerifyWINDOW1Toolbars(), if one of the Toolbat button doesn't work, the function still passed.

    [-] testcase Win_Veri() appstate DoNothing
    [ ] STRING sContinueWithError
    =VerifyWINDOW1Toolbars("YES")
    [-] if sContinueWithError == "YES"
    [ ] sContinueWithError
    = VerifyWINDOW1Menu("YES")
    [-] if sContinueWithError == "YES"
    [ ] sContinueWithError
    = VerifyWINDOW2("YES")


    [-] STRING VerifyEMWToolbars( string sRaiseErrorException)
    boolean t=true
    [+] do
    [ ] Window.SetActive()
    [-] if !Window.ToolBar.Button1.IsEnabled()
    [ ] t=false
    [ ] LogError( "ERROR:
    ToolBar Button1 is not enabled!")
    [-] if !Window.ToolBar.Button2.IsEnabled()
    [ ] t=false
    [ ] LogError( "ERROR:
    Toolbar Button2 is not enabled!")
    [ ] return "YES"
    [-] except
    [-] switch sRaiseErrorException
    [-] case YES
    [ ] ExceptLog
    [ ] return "NO"
    [-] case NO
    [ ] ExceptLog()
    [ ] return "YES"

  4. #4
    Junior Member
    Join Date
    Jan 2002
    Location
    Denver, CO
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error Handle

    It's not completely clear to me what you're trying to do with your return values of "YES" and "NO" in the VerifyEMWToolbars() function. I assume that "YES" means they verified successfully, and "NO" means they did not. If that is the case, I would expect you to return a value of "NO" in both situations below your except statement. Maybe I am misunderstanding.

    However, I will restate my earlier point. If exceptions are being raised in your code, it indicates a bigger problem with the script that should be fixed first. If you are simply running the IsEnabled() function, it should return a true or false value. It should not raise an exception unless that control does not exist at the time you are checking it. You may want to use Exists(), followed by IsEnabled(), to avoid any exceptions from being raised. I think you will be much better off eliminating your do...except statements completely, and to avoid raising any exceptions.

    ------------------
    Paul Fountain
    QA Analyst/Engineer
    Sungard Insurance Systems
    Paul Fountain
    QA Analyst/Engineer
    Sungard Insurance Systems

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

    Re: Error Handle

    First of all the best way for automation testing is to have independente small blocks of code. You have to start with the right direction otherwise it's a waste of time to try to implement a recovery system afterwards(it's possible but harder).

    That said, silk's exceptions are not always critical. 2 things you can do.

    The first thing you can do is to process the exception info returned by ExcepCalls(), and ExceptData()(if not critical continue).

    The second thing you can do is to jump to the next independent block of code using a goto, otherwise your script will terminate by silk.




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

 

 

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 12:19 PM.

Copyright BetaSoft Inc.