SPONSORS:






User Tag List

Results 1 to 10 of 10
  1. #1
    Guest

    How do I add functions/methods in ST?

    How do I add a function/method in ST? I have been trying to tidy up my code a bit and realize that I use a lot of the same steps in several testcases (not an appstate though)and would like to make these steps into a function so that I can just call it w/out having to copy and paste the same set of steps again and again.

    I tried the following code but keep getting syntax errors and help isn't "helping. . ."

    STRING sBrowseQuery

    [-] void UseBrowseQuery () ******
    [-] if sBrowseQuery == "Y"
    [ ] CompanySearch.OptionsMenu.UseBrowseQueryCheckBox.C heck ()
    [-] else
    [ ] CompanySearch.OptionsMenu.UseBrowseQueryCheckBox.U ncheck ()

    Can anyone point me in the right direction?

    Thanks!

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

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

    Re: How do I add functions/methods in ST?

    A couple of things would help us help you ...

    First, if you can, use the "code" keywords to format your example as code -- that way we can see the indentation, etc.

    Second, include the errors that you're getting from Silk.

    My guess is that it's simply a question of indentation / format that's biting you.


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

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Location
    UK, Oxford
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do I add functions/methods in ST?

    To be more explicit;
    [CODE]
    Your code goes here...
    [/CODE]

    ------------------
    Tempus fugit, Carpe Diem, et al

  4. #4
    Junior Member
    Join Date
    Sep 2002
    Location
    Oxford, U.K.
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do I add functions/methods in ST?

    where are you putting this function? If you want to make it a global function it needs to be sitting in the global space (i.e. outside a testcase). If you want an instance method throw it in a class.

    ------------------
    Real computer scientists don't program in assembler. They don't write in anything less portable than a number two pencil.
    Real computer scientists don't program in assembler. They don't write in anything less portable than a number two pencil.

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

    Re: How do I add functions/methods in ST?

    johntest, how did you do that? I mean have your message print the code tags as literals, without it interpreting them as tags?

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

  6. #6
    Senior Member
    Join Date
    Nov 2001
    Location
    UK, Oxford
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do I add functions/methods in ST?

    I used entity references, so you do:
    [CODE]
    [/CODE]


    ------------------
    Tempus fugit, Carpe Diem, et al

  7. #7
    Junior Member
    Join Date
    Sep 2002
    Location
    Oxford, U.K.
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do I add functions/methods in ST?

    Heh, here's the recursive case.

    To type an ampersand in HTML, you use &.

    ------------------
    Real computer scientists don't program in assembler. They don't write in anything less portable than a number two pencil.
    Real computer scientists don't program in assembler. They don't write in anything less portable than a number two pencil.

  8. #8
    Senior Member
    Join Date
    Nov 2001
    Location
    UK, Oxford
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do I add functions/methods in ST?

    Shadow flair is right:
    in order to show the following entity reference:
    [
    I have to go:
    [
    and in order to show that I have to go:
    [

    and so on and on and on and on...

    and I when I went back to edit this I had to pick through it all again as the browser and already expanded it all... ergg...!


    [This message has been edited by johntest (edited 11-20-2002).]
    Tempus fugit, Carpe Diem, et al

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

    Re: How do I add functions/methods in ST?

    ... and I suddenly feel much better ...

    I couldn't get the darn things to show up right so resorted to my original approach.

    ... pity the poor schmucks that search for this topic on the forums ... < grin > ...


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

  10. #10
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do I add functions/methods in ST?

    Anyway, back to 25's question, you should be able to put your code anywhere that will make it accessible to you when you want to call it. I tend to use a shared include file and place all my public methods/functions there. If it is something you want to keep locally in your *.t file, then make yourself a section for special methods and place it there; perhaps right underneath your use statememnt

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

 

 

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:45 PM.

Copyright BetaSoft Inc.