SPONSORS:






User Tag List

Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Jun 2002
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    My first chance! Rookie question re raise statement

    Fun! I'm just out of school, got an internship, assigned to the QA dept, learning SilkTest. I've spent the last week with the User Guide and sample scripts and learn-by-doing sort of stuff. And I've hit a stumper. It's a small department, and no one is an expert, and we're just trying to move into the automation thing.

    From what I read in the manual, raising an exception should enter the exception message in the results file. So to try to see it work, I wrote a simple script that calls up a web page, and coded it to make the Verify method throw an exception. Here's the section I'm referring to:

    I expected this to print the string "Error" to the results file. But it doesn't. I can get it to print by changing the ending to be

    As long as I know I can make an exception leave me a message, I'm not too spooked, but I've read the manual on the raise staement again and again, and unless I'm misunderstanding, it says that raising causes a print to the results file.

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

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    186
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: My first chance! Rookie question re raise statement

    Try declaring and instantiating the variable before you hit this section:

    ------------------
    Tom
    Tom

  3. #3
    Senior Member
    Join Date
    Jun 2002
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: My first chance! Rookie question re raise statement

    If I understand you, I am to declare and instantiate the string at the beginning of the testcase code. So I stripped my testcase down to the utter simplest

    I have the two options in the last if statement. I can switch the commenting back and forth and run the testcase. The raise option terminates the script right there (the Browser.Close() is not reached) whereas the Print() option prints to the results file with one of those "+" box symbols, and the browser closes.

    (the URL goes to the student website at NHTI where I just graduated)


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

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    186
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: My first chance! Rookie question re raise statement

    I don't think you need
    you can just do
    If you want to close the Browser even when there is an error, you could put another Browser.Close before the raise 1 inside the if statement. Or you could not use raise at all, and do something like this:

    ------------------
    Tom
    Tom

  5. #5
    Senior Member
    Join Date
    Jun 2002
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: My first chance! Rookie question re raise statement

    yeah, I didn't like the

    sException = sException + "Error"

    but that's what another guy here was using and the first way I saw it done, so I was following it. I agree that

    sException = "Error"

    makes more sense and is easier to read.

    I also just discovered the ErrorLog() method and had just rewritten my script exactly the way you suggested, and it did what I expected and wanted.

    So I'm clear I have a workable exception handling routine. I'm just still puzzled that the User Guide seems so clearly to say that "raise" writes to the results file. I'll just have to let it go, I guess.

    Hey, thanks a bunch

    F

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

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

    Re: My first chance! Rookie question re raise statement

    The raise statement should write to the results file.
    If your use of that isn't printing anything to the results file, a couple of things could have happened.

    Someone messed with your defaults.inc file and deleted the ExceptLog statement out of your DefaultTestCaseExit. (Little known fact but that's where almost all error messges come from.)

    Another possibility is that someone wrote a TestCaseExit function (that'll override DefaultTestCaseExit) and neglected to put the code in there that needs to be in there. Namely, the same stuff that's in DefaultTestCaseExit.

    - Dave


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

  7. #7
    Senior Member
    Join Date
    Jun 2002
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: My first chance! Rookie question re raise statement

    Thanks dcreed. Gotta reply to this one.

    After a week of increasing franticity -- how can I write effective testplans that can't raise exceptions??!! -- I found the error. I was reading in the User Guide and found the mention of ExceptLog and its meaning, and went back to look, and sure enough, it was missing from the overridden TestcaseExit().

    The woman I was learning from (she was leaving, and I had two weeks to learn what I could from her) had written her own TestcaseEnter and TestcaseExit, which included code to write stuff out to a log file. One of the ways I try to learn is to study what others do and then try it on my own, writing it without looking back and copying the "model" code. So I wrote code for my own version of a log file (fun to build that one -- I made it enter all kinds of data!) in my own TestcaseExit, and the one line I left out was the ExceptLog() call. Since it was tucked away in a file called methods.inc, where I didn't look at it much after that, and I didn't know anything about its role in sending exceptions to results files, it just slipped by unnoticed. Kind of like pulling the plug on something and a week later you can't figure out why it doesn't work.

    Anyway, it all worked out OK, and this morning I go into battle for the first time on my own, knowing that it works now. Scary, but all's well that ends well, and an excellent learning experience.

    I remembered this post, and came back just now, and of course had to reply.

    Thanks, all, for your help

    felecha

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


    [This message has been edited by felecha (edited 07-22-2002).]

 

 

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 03:59 AM.

Copyright BetaSoft Inc.