question

venkatb avatar image
venkatb asked venkatb posted

Not able to use the variables stored from the response

Hi ,

 I am trying to find the average of two numbers.

 For this I used linux 'od -An  -N2 -i /dev/random %100' command.

 I run this commands twice and storing the returned response into $randvalue1 and $randvalue2.

 

 When I try to find the average of those to values by ' set z [expr [expr $randvalue1 + $randvalue2]/2]'

iTest is reporting error that $randvalue1 is not found.

 

I am attaching the test and the report here.

 

If anybody can pointme how to do this, that would be greatful.

 

Thanks,
Venkat

 

iTestresponse map
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
PaulD avatar image
PaulD answered PaulD posted

The problem is that you checked the box that stored randvalue1 in a global variable.  But $randvalue1 will only find a local variable with that name.  If you need to fetch it from a global variable, then you need to use [gget randvalue1].

 

I suspect that you don't need to make this global anyway.  Right?

1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

venkatb avatar image venkatb commented ·

Thanks Paul.

It worked the way without global variable.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.