SPONSORS:






User Tag List

Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Nov 2000
    Location
    San Jose, CA USA
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to instatntiate a cistom winclass in Silk?

    Collegues,

    I had defined this class for catching memory leaks (no errors):

    //begin
    //filename: memleak.inc

    [-] winclass Memleak
    [ ] LONG m_old_memory, m_tolerance, m_failcount, m_max_failcount
    [-] BOOLEAN Init(LONG tolerance, LONG max_failcount)
    [ ] m_old_memory = SYS_GetFreeMemory()
    [ ] m_max_failcount = max_failcount
    [ ] m_tolerance = tolerance
    [ ] return m_old_memory > 0
    [-] BOOLEAN CheckMemory()
    [-] if (m_old_memory < SYS_GetFreeMemory() + m_tolerance)
    [ ] ++m_failcount
    [-] else
    [ ] m_failcount = 0
    [ ] return m_failcount > m_max_failcount
    [-] LONG AmountLeaked()
    [ ] return m_old_memory - SYS_GetFreeMemory()
    [-] void Reset()
    [ ] m_old_memory = 0
    [ ] m_failcount = 0
    //end

    Then I tried to instantiaie it like this:

    //begin
    use "memleak.inc"

    [-] testcase AutoScanTest()
    [ ] Memleak m_leak
    // Rest of my testcase
    //end

    Anf got error "Memleak is not a type".

    How to avoid it? How to instantiate a custom class in Silk?

    Thank you all,
    Nick

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

    Re: How to instatntiate a cistom winclass in Silk?

    Nick:

    Even though your class has no GUI object associated with it, the keyword to instantiate a particular object with a class is "window".

    This is just one of the peculiarities of SilkTest.

    Instead of:
    Memleak m_leak

    Declare:
    window Memleak m_leak

    [This message has been edited by RobKapteyn (edited 01-23-2001).]
    Rob Kapteyn, CSTE
    RobKapteyn@gmail.com

  3. #3
    Senior Member
    Join Date
    Jun 2000
    Location
    Waltham, MA
    Posts
    107
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to instatntiate a cistom winclass in Silk?

    A Winclass cannot be instantiated in a testcase. I think what you are looking for in your example is to declare MemLeak as a function, and then use that function in your testcase. See below:

    Memleak ()
    //Rest of function code.

    testcase AutoScanTest()
    MemLeak ()
    // Testcase statements.

    *** You can also have your Memleak function return a value to your testcase. You would declare your function with as a data type, such as STRING Memleak() or INTEGER Memleak(), and have the last statement of the funtion return a value, by using the return statement. In your testcase, you can assign a variable to that function, in which to save the value. EX:

    STRING Memleak()
    STRING sValue
    // Code
    return sValue


    testcase AutoScanTest()
    STRING sGrabbedValue
    sGrabbedValue = Memleak()
    // Rest of testcase

    Hope that helps.
    BostonSilk

  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: How to instatntiate a cistom winclass in Silk?

    BostonSilk is right, you ALSO need to move your "window" declaration out of any testcases.

    This is a requirement I wish SilkTest could eliminate ...
    Rob Kapteyn, CSTE
    RobKapteyn@gmail.com

  5. #5
    Junior Member
    Join Date
    Nov 2000
    Location
    San Jose, CA USA
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to instatntiate a cistom winclass in Silk?

    Thank you all!

    This declaration

    //begin
    window Memleak m_leak
    //end

    outside testcase worked.

    Nick

  6. #6
    Senior Member
    Join Date
    Jul 1999
    Location
    Boston, MA. USA
    Posts
    163
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to instatntiate a cistom winclass in Silk?

    BostonSilk could you please email me offline - I have a question for you.
    Thanks!
    Heidi Gilmore
    hjgilmore@mediaone.net or heidig@segue.com

  7. #7
    Senior Member
    Join Date
    Aug 1999
    Location
    MA
    Posts
    129
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to instatntiate a cistom winclass in Silk?

    kender_a,
    4Test is a superb object oriented language, your initial attempt looked very C++ like. I think that says a lot... Way to go Segue .
    Steven Tyler
    Manager - Performance Engineering

    Kronos Incorporated
    tel: +1 978 947 4219

 

 

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:35 AM.

Copyright BetaSoft Inc.