Ask test developer questions, discuss and share ideas on how to best implement elementary blocks or interfaces.

Environment Variable

Postby AlphaTester » 9. Dec 2008, 09:45

Hello,

I'm using an environment variable. When I start Expecco the variable is set to 1.
During the test this variable is changed.
When I look into the Environment-Tab (after the test) the initalisation value will be displayed(1).
And now I execute this test again: The latest value from the first run will be used (and not 1).

1) is it possible to display the current value of the variable in the environment tab (no test execution)?
2) is it possible to change the value (no test execution)?

Thanks!
--
(while(!asleep())sheep++;)
AlphaTester
 
Posts: 19
Joined: 5. Dec 2008, 08:44
Location: Kerpen

Re: Environment Variable

Postby cgittinger » 11. Dec 2008, 18:10

I agree: we will add some visualization to the next release
(at least an "inspect current value" popUpMenu item - better, an additional column in the variable-editor).

Beside that, I would like to ask for what you think which is the best way to handle variables which are modified by the test. is there a "best practices" pattern which we should recommend ?

One pattern we use often is to have actually two variables, one being readOnly and providing the actual default value, the other being used as a modifyable value during execution. When started, some block is responsible to set the runtime variable to its initial value (*). One variable should be named "initial_X", where X is the name of the runtime variable.

This raises the question, of where such variables should be placed best: obviously, the project-environment is easy to find and central. On the other hand, it is initialized only once: at project load time, or when initialized explictly via the popUpMenu.
A per-test-plan environment or the testcase-actions-environment would probably be better for such mutable runTime values, because they get reinitialized with every execution.

Do you have any other (better) idea for this situation ?

Claus

(*)
actually, it should even be possible to use the "initial_X" in the init-expression of the "X" variable. I.e. in the "X" variable slot, change the "initialization-type" from "Constant" to "Smalltalk Expression", and define the init-expression as "initial_X". However, the current expecco version has a bug in that the project environment is not visible when the init-expressions are evaluated.
This will be fixed in a later version (its obviously so advanced a feature, that most users did not even realize that you can also use a computed expression as initial value of a variable ;-).
cgittinger
 
Posts: 61
Joined: 12. Nov 2008, 17:05

Re: Environment Variable

Postby AlphaTester » 16. Dec 2008, 09:31

cgittinger wrote:One pattern we use often is to have actually two variables, one being readOnly and providing the actual default value, the other being used as a modifyable value during execution.

I think that this is a good solution. But both of them should be displayed in the Environment Tab.

cgittinger wrote:...This raises the question, of where such variables should be placed best...

Two points:
1) The place dosen't make any diffrence to me. There should be a Tab which displays all used variables (also the variables from diffrent libs (separated by a new headding))
2) If 1) is realized, you will see that one variable could be displayed twice or more (used in different libs or a hand over from a imported lib). This could be a problem, to find out which variable is actual used. To find a good solution for this problem could be a challenge.

Regards
--
(while(!asleep())sheep++;)
AlphaTester
 
Posts: 19
Joined: 5. Dec 2008, 08:44
Location: Kerpen


Return to Test Developer Help

Users browsing this forum: No registered users and 1 guest

Design by GB