Toad World® Forums

Global variables


#1

I would like to see the inclusion of global (constant) variables and maybe packages.

It would nice to be able to define some costants within the tool and define a procedure or two for setup or any other common need
and then make assertions which can use the global variables and or the results from the packages.

The only variables/code that I can define seem to be private to each test. oftenmy setup code is very similar across many tests.

Or, is it that I have just not found the option yet


#2

In the test-editor (from the dashboard, right click --> edit), go to the properties section (of the left-handside). On the right there are several tab-pages, one of them is called “Customizations”. Here you can define the initialization of all the unit-tests.

Is this what you were looking for?


#3

Alex,

Thanks for asnwering this before I could get to it! Love that…

Yes, Nick, you can specify your own global constants, variables, subprograms, both in the pkg spec and in the body, through the Customizations tab. You will find this tab at virtually every level in the hierarchy.

If you want to TEST a packaged variable, create an outcome with a Changed by Program type of Expression, then provide the name of the variable in the Properties window.

Regards, SF


#4

Thanks for asnwering this before I could get to it! Love that…

isn’t that what’s a forum is all about? Asking questions and answering if you can…


#5

Thats what I was after - Thanks -


#6

I FOUND The following under customisations + my changes
PROCEDURE MYFUNCTION
/* Unit test procedure for MYFUNCTION */
AS
– Declarations of custom non-program elements
– NICK – Declarations of custom non-program elements

– Declarations of custom procedures and/or functions
– NICK – Declarations of custom procedures and/or functions
BEGIN
– Initialization for this unit test
– NICK – Initialization for this unit test

/* Run each test case */

– Cleanup for this unit test
– NICK – Cleanup for this unit test
EXCEPTION
– Exception handling for this unit test procedure
– NICK – Exception handling for this unit test procedure
END MYFUNCTION;
Which enables me to define just about about everything apart from the body of my
custom non-program elements.
Am I still looking in the wrong place?


#7

Hi NickStrange,

I think you need to go to the top of the “tree like” thing (navigator) on the left hand side in the test editor, where it says “Properties”.
You probably selected one of the test-cases.

I have attached a screen-shot, hopefully that will clarify things.


#8

Thanks for the reply. That was the tab I was using

My tab has:
– Declarations of custom non-program elements.
Which is great - I can define my global constants here

– Declarations of custom procedures and/or functions
Which quite happily takes function and procedure specs (but not body).

There does not seem to be an equivalent
–Declarations of custom procedures and/or functions
There is one for functions and procedures at the test level but not global!


#9

HHHHHHMMMMMMMM…

Now how the heck did I miss that?

It appears, Nick, that you are correct. We let you define things in the package spec, but do not give you a way to implement those subprograms in the body (or simply hvae private elements.

Whew. OK, we will get that fixed. Immediatley. Thanks, and sorry it took so long to get the point!

SF


#10

No problem - I learn’t a lot while looking for it


#11

Probably need another test case!


#12

Steven,

Do my tired eyes deceive me, or are you on a direct path to implement the ultimate solution for test dependencies?

Let’s see… Package spec variables = session persistent information + my very own procedures that may be called independently or by means of any other test script/procedure. That would allow me to feed the (modified) result of one test case as the initial, or any other kind, of input to the next, next-next, Etc.

Could be one heck of job determining what it is you’re really testing :slight_smile:

But, seriously, I like that feature. Use it with care, and I’m sure it can prove very useful.

Mike

Message was edited by: MAGIC51