QAPUSER Digest 808

Wednesday, March 04, 1998

  1. Topic No. 1 by rja@netcom.com
  2. Segue Regional Training in March by "Randy Robar"
  3. Static Variables by Danil Suits
  4. Object Constructors. by Alain Lapalme
  5. FW: New England User Meeting This Week by Danil Suits

Topic No. 1

Date: Wed, 4 Mar 1998 10:34:19 -0500 (EST)
From: rja@netcom.com
Topic No. 1
noop                                                                                                              
Received: from netcom.com ([9.95.77.72]) by arista.iris.com (Lotus SMTP MTA v4.6.1  (569.2 2-6-1998)) with SMTP id 852565BD.00560F0B; Wed, 4 Mar 1998 10:39:59 -0500
Message-ID: <34FD74FC.6707E7A9@netcom.com>
Date: Wed, 04 Mar 1998 10:36:28 -0500
From: "rja@netcom.com" 
Reply-To: rja@netcom.com
X-Mailer: Mozilla 4.04 [en] (WinNT; U)
MIME-Version: 1.0
To: qapuser@segue.com
CC: DGlauser@Atl.Carreker.com
Subject: Re: Static Variables
References: <199803041521.KAA16094@segue1.segue.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

> Date: Wed, 4 Mar 1998 10:12:01 -0500
> From: Dan Glauser 
> To: qapuser@segue.com
> Subject: Static Variables
>         In 4Test I'm looking to have a function which contains a
> variable that retains its value through successive calls to the
> function.  In other words, a static variable (C/C++ terminology).  Is
> there anything similar in 4Test or do I have to use a global?

Dan,

4Test doesn't have static variables (hopefully not yet)
There are (at least) 2 ways to achieve what you want to do :
(1) use a global.
(2) Use FileWriteValue and FileReadValue.

cheers
 -- ronnie
-- 
mailto:rja@netcom.com   ** PGP-encrypted mail accepted **
PGP public key available by finger. Key/ID #: 1024/F37FD7Dnoop                                                         

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


Topic No. 2

Date: Wed, 04 Mar 1998 11:32:16 -0500
From: "Randy Robar" 
Topic No. 2
Message-ID: <34FD820F.F3902D3E@segue.com>

Hi Everyone,

A friendly notice that Segue will be holding public training classes in
the following cities in March:

   Chicago
   McLean
   Burlington, MA
   San Francisco
   New York

You can check out our web site (www.segue.com) or call our Services
Coordinator, Sue Reuger, @ 617-796-1026 for more info or to register.
Happy Testing!

randy robar
training mgr


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


Topic No. 3

Date: Wed, 4 Mar 1998 12:06:01 -0500
From: Danil Suits 
Topic No. 3
Message-ID: <91649E5C6399CF1187E100A0240EB11A35404F@EARTH>

> 	In 4Test I'm looking to have a function which contains a
> variable that retains its value through successive calls to the
> function.  In other words, a static variable (C/C++ terminology).  Is
> there anything similar in 4Test or do I have to use a global?
> 
There is no equivalent to static inside a function.  However, you can
use private to limit the scope of a variable to the file in which it is
declared  (_4Test Language Reference_ "Language Summary -
Declarations").

So if you can isolate the function in it's own .inc file, then you can
get the effect you want by declaring the variable to be private outside
the scope of the function.

/* A.inc */
//this is available to everything that includes A.inc
integer myA = 1 ; 
//this can only be used inside A.inc
private integer myB = 2 ; 

ATest ()
{
	print ( myA ) ;
	//OK, ATest is inside A.inc
	print ( myB ) ; 
}

/* B.inc */
BTest ()
{
	//OK, myA is global
	print ( myA ) ; 
	//Compile Error - myB not in scope here
	print ( myB ) ; 
}

/* Main.t */
use "A.inc" ;
use "B.inc" ;

main ()
{
	ATest () ; //Fine
	
	//Compile Error, B.inc doesn't compile
	BTest () ; 
	
	print ( myA ) ;
	
	//Compile Error - myB not in scope here
	print ( myB ) ; 
}

Here's an example using a privately declared winclass

/* C.inc */
private winclass C { integer m = 2 ; }

//A "constructor" [actually, a factory method, but why quibble]
window GetC( string sTag ) { return C(sTag) ; }
	
/* Main.t */
use "B.inc" ;

main ()
{
	//doesn't compile - winclass C is private
	//window theC = C("theB") ; 

	//Access via the factory
	window theOtherC = GetC("theOtherC") ; 
	
	//class members are available!
	print ( theOtherC.m ) ; 
}

As best I can tell, private is only allowed when working in the file
scope.  It doesn't compile inside of functions, or inside of classes.
If you want to create a private class member, for instance, you are
going to have to be clever - it can be done, but it is more effort than
it is worth.

Mr. Cluey





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


Topic No. 4

Date: Wed, 4 Mar 1998 13:12:44 -0500
From: Alain Lapalme 
Topic No. 4
Message-ID: 

Hi

I've been trying to find out if there is an elegant way of defining 
constructors for user defined classes.

This is the way we are doing it now:

//the class definition
winclass MyClass
{
	string sInit	
}

//the constructor
window MyClassConst(string sString)
{
	window Temp
	Temp = MyClass()
	Temp.sInit = sString
	return (Temp)
}


//code creating a new object via the constructor
main()
{
	window wClass = MyClassConst("teststring")
	Print (wClass.sInit)		//prints the string "teststring"
}

While this works, I find it a bit odd since,  in essence, the 
"constructor" is not really a constructor but a global function. I 
would rather do something like C++ where the constructor(s) is/are 
defined within the class.

The way an object is created:
	window myObject = MyClass()

and the fact that there are brackets at the end of MyClass, seems to 
imply that parameters can be passed, eg MyClass("teststring").  I 
tried that, compiled and ran it and there were not problems.  However, 
I'm still stuck trying to capture that parameter from inside the 
class.  Does anyone know if this is doable and, if so, how?

Alain Lapalme
JetForm Corporation





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


Topic No. 5

Date: Wed, 4 Mar 1998 13:33:14 -0500
From: Danil Suits 
Topic No. 5
Message-ID: <91649E5C6399CF1187E100A0240EB11A354052@EARTH>


> March 4, 1998
> Presentation: Testing Web based applications. Danil Suits, Silknet
> Software, Inc. 
> Time: 6:30pm. 
> Venue: Bay Networks. There are a several maps available. 
> Directions from Boston: 
> From 495:
> Take 93N then follow from BOSTON direction
> 
> From 93S:
> Take EXIT 45. Turn Right at the traffic Light at the end of the ramp.
> Pass
> three more traffic lights.  At 0.4 miles from the third traffic light
> follow (bbb)
> 
> 
> From BOSTON:
> On 93N take EXIT 45 - RIVER Rd.  (Exit 45 is after 495)
> At the traffic light at the end of the ramp take a left.
> Pass two more traffic lights.  At 0.4 miles from the second traffic
> light
> (bbb)
> take a Left on to Bulfinch Dr.  (a big sign says  - RIVER View
> commons,  a
> small sign says Andover Business Park)  If you pass this Bulfinch Dr.
> a
> very small sign says "Entering LAWRENCE"  Bulfinch is about 0.9 miles
> from
> the end of the 93 N ramp.
> On Bulfinch Dr. the first building on the Left is BAY.  Park in the
> front.
> RING the bell the guard will open the door.  Ask for the QAPartner
> meeting.
> 
> 
> Maps available at
> http://www.ultranet.com/~danil/Cluey/maps.html
> 
> Details about the User group available at
> http://www.ultranet.com/~danil/Cluey/bosuser.html
> 
> 
> 
> 
Danil Suits
Silknet Software Inc.


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